Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information