-
Notifications
You must be signed in to change notification settings - Fork 941
Add development spec for per-timeseries start time tracking #4807
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
base: main
Are you sure you want to change the base?
Conversation
ab17001 to
27eeb60
Compare
9e177f2 to
2fd26c4
Compare
|
|
||
| **Status**: [Development](../document-status.md) | ||
|
|
||
| The start timestamp for a timeseries is the timestamp which best represents the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the language "best represents". There is not a universal approach here, and there are tradeoffs. "Best" can be subjective, I think, giving room for implementations to stay compatible.
Best may include:
- start time of the SDK
- first observation of the series
- last collection interval
It is important to leave this open because each has different requirements for memory, especially considering future changes to support remove().
| - The time interval is inclusive of the end time. | ||
| - Times are specified in Value is UNIX Epoch time in nanoseconds since | ||
| `00:00:00 UTC on 1 January 1970` | ||
| - The `start` timestamp best represents the first possible moment a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean I need to ask the kernel when my process was created? Or, does this mean it is just whenever I get to initializing the metric system?
It also needs to be made clear this does not represent the time the thing being measured began (i.e. a car start time or manufacturer date when measuring an odometer reading)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I don't think i'm changing the specification here. I'm using the language already used for other instruments consistently for all instruments.
Fundamentally, all events that are part of an aggregation should occur between the start and end times.
Does this mean I need to ask the kernel when my process was created? Or, does this mean it is just whenever I get to initializing the metric system?
Depends on when the thing you are measuring starts. For a counter that starts counting when the process was created (e.g. container.cpu.time), it would be correct to use the time at which the process started. If the metric system is the system counting events, and starts from zero, then it is correct to use the start time of the metric system as the start time for metrics recorded after it starts.
It also needs to be made clear this does not represent the time the thing being measured began (i.e. a car start time or manufacturer date when measuring an odometer reading)
It could represent the time the thing being measured began. Either of the two listed are possibly correct, but if you use the car start time, then the aggregation should only include events that occur since the car started. I would be rather confused if my car's speed graph indicated that I went 10k mph pulling out of my driveway this morning because it reported that I had done my odometer's reading in the first 30 second interval :).
ArthurSens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this one :)
…tions This change moves the start timestamp from the aggregator level to the per-timeseries data point level for cumulative temporality. Each time series now records its own creation time, which is used as the StartTime in collected metrics. Prototype for open-telemetry/opentelemetry-specification#4807 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes #4184
Prerequisite for #2232.
Changes
This adds requirements around start time handling for metrics SDKs:
starttimestamp best represents the first possible moment a measurement for this timeseries could have been recorded."This also restates "the start timestamp MUST equal the previous interval's timestamp" from the data model specification to ensure it isn't read as requiring changes for Delta metrics.
The effect of this change is that all cumulative metrics SHOULD use at least the previous export interval for "new" timeseries. That should be very straightforward, as it is what is done for delta metrics today. I would love for this to be a MUST, but i'm concerned it could be considered breaking.
Additionally, SDKs SHOULD use the current timestamp for "new" timeseries. This could have a performance cost, so it isn't a MUST.
Omissions
While it is possible for delta metrics to track the attribute sets exported in the previous interval, it is expensive to do so because it requires tracking the attribute sets that were present in the previous collection interva. This would enable SDKs to differentiate between an "unbroken" series, and a "new" one to provide a more accurate start time when observing "new" series. I doubt this is something delta backends would care about enough to be worth the cost.
cc @ArthurSens @atoulme @jmacd
Prototypes