Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/ottl] set always uses UTC #34161

Open
agardnerIT opened this issue Jul 18, 2024 · 7 comments
Open

[pkg/ottl] set always uses UTC #34161

agardnerIT opened this issue Jul 18, 2024 · 7 comments
Labels
help wanted Extra attention is needed pkg/ottl priority:p2 Medium processor/transform Transform processor

Comments

@agardnerIT
Copy link
Contributor

Component(s)

processor/transform

What happened?

Description

Opening at the request of @TylerHelmuth as per this Slack thread.

I'm using set(time, Now()) in the transform processor but it's setting time to UTC (+0000) while my system time is +1000

Steps to Reproduce

Expected Result

The transform processor / OTTL should either:

  1. Respect system time
  2. Have the ability to set a timezone eg. set(time, Now().Timezone("AEST")

Actual Result

Collector version

v0.103.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

...
processors:
  transform/add_timestamp:
    log_statements:
      - context: log
        statements:
          - set(observed_time, Now())
          - set(time, Now())
...

Log output

No response

Additional context

No response

@agardnerIT agardnerIT added bug Something isn't working needs triage New item requiring triage labels Jul 18, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the processor/transform Transform processor label Jul 18, 2024
@TylerHelmuth TylerHelmuth added pkg/ottl and removed needs triage New item requiring triage labels Jul 18, 2024
Copy link
Contributor

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth
Copy link
Member

TylerHelmuth commented Jul 18, 2024

This is happening because all our time setters, such as

tCtx.GetLogRecord().SetTimestamp(pcommon.NewTimestampFromTime(i))
, use pcommon.NewTimeStampFromTime which uses the UTC value of the time.

@TylerHelmuth
Copy link
Member

@agardnerIT can you confirm that the UTC representation of the time.Time value is the correct UTC value for your local time?

@TylerHelmuth TylerHelmuth added discussion needed Community discussion needed and removed bug Something isn't working labels Jul 18, 2024
@agardnerIT
Copy link
Contributor Author

I'm not really sure I follow you but my system clock right now is 20:04 and time.is/UTC says 10:04

Output from a few seconds ago (so that tallies):

ObservedTimestamp: 2024-07-19 10:03:47.556182 +0000 UTC
Timestamp: 2024-07-19 10:03:47.55651 +0000 UTC

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Sep 18, 2024
@TylerHelmuth TylerHelmuth added help wanted Extra attention is needed priority:p2 Medium and removed Stale discussion needed Community discussion needed labels Nov 15, 2024
@TylerHelmuth
Copy link
Member

TylerHelmuth commented Nov 15, 2024

We would like to add more timezone support for working with timestamps on otel signals. Being able to say "this time should be considered MT" in a transformation is proper, even if behind the scenes the data is always stored as the equivalent UTC time by pdata.

@TylerHelmuth TylerHelmuth changed the title set always uses UTC [pkg/ottl] set always uses UTC Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed pkg/ottl priority:p2 Medium processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

2 participants