Skip to content

Commit 5b4abb5

Browse files
dashpoleOrHayat
authored andcommitted
Fix timestamp handling for the lastvalue aggregation (open-telemetry#5517)
Fixes open-telemetry#5510 From https://opentelemetry.io/docs/specs/otel/metrics/sdk/#metricreader: > The ending timestamp (i.e. TimeUnixNano) MUST always be equal to time the metric data point took effect, which is equal to when [MetricReader.Collect](https://opentelemetry.io/docs/specs/otel/metrics/sdk/#collect) was invoked. These rules apply to all metrics, not just those whose [point kinds](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#point-kinds) includes an aggregation temporality field. Before open-telemetry#5305, we used the measurement time as the timestamp, but it didn't matter because the collection time is always the same as the measurement time for asynchronous instruments. We didn't catch the issue when we implemented synchronous instruments. This PR changes the (end) timestamp handling for the Last Value aggregation to match the (end) timestamp handling for sum and histogram aggregations. As described in the spec above, we take the timestamp when computing the aggregation during Collect.
1 parent ee1d012 commit 5b4abb5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
4545
- Run the `Detect` method in `go.opentelemetry.io/otel/sdk/resource` in parallel. (#5402)
4646
- Fix panic in baggage creation when a member contains 0x80 char in key or value. (#5494)
4747
- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their coresponding environment variables in in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508)
48+
- Fix stale timestamps reported by the lastvalue aggregation. (#5517)
4849

4950
## [1.27.0/0.49.0/0.3.0] 2024-05-21
5051

0 commit comments

Comments
 (0)