-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Support interacting with timestamps in at different precisions #16067
Comments
@bogdandrutu had the idea to change the time accessors in the ottl contexts to return and accept In order to support this change the following items must be addressed:
|
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 Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
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 Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Component(s)
pkg/ottl, processor/transform
Is your feature request related to a problem? Please describe.
Currently, the OTTL only supports getting and setting timestamps with nanosecond precision. While this is semantically correct with the OTLP proto, there are times when interacting at such a specific precision is unnecessary and cause un-ergonomic statements.
For example, when comparing the duration of a trace (supported via math operations added via #15675), comparing the result in nanoseconds seems excessive:
Another use case where adjusting timestamps will be necessary is when adjusting for clock skew.
Describe the solution you'd like
This could be achieved via any of the following options (non-exhaustive)
precision-specific functions such asseconds(nano-timestamp int64)
,msec(nano-timestamp int64)
, nsec(nano-timestamp int64)`, etc.A since time-precision function such asprecision(nano-timestamp int64, precision string/ENUM)
A generic rounding function that can round any int64.Adding more context accessors that know how to Get and Set using the specific associated precision.@bogdandrutu had the idea to change the time accessors in the ottl contexts to return and accept
time.Time
values instead of int64. This has the advantage of standardizing how time is returned and set and should solve any potential problems when setting a time with a different precision. It will also open the doors for more complex time transformations such as timezone manipulationsIn order to support this change the following items must be addressed:
time.Time
type from a string. #22007time.Duration
type from a string. #22015time.Time
types #22008time.Duration
types #22713time.Time
andtime.Duration
types. #22009time.Time
andtime.Duration
into an number #24686time.Time
and Setters taketime.Time
#22010Describe alternatives you've considered
No response
Additional context
We will need to be careful not to break any usage of
set
and a timestamp field. At the moment all timestamp Setters expect an int64 that is representative of nanoseconds since epoch time. If we create any functions that change the precision, we need to help users not break their timestamps if they try to use them inset
.Related to #12974
Related to #14142
The text was updated successfully, but these errors were encountered: