open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.67k stars 570 forks source link

Incorrect StartTimeUnixNano for SumAggregation with Delta Temporality after empty collection #4010

Closed ocelotl closed 1 day ago

ocelotl commented 2 days ago

Describe your environment

OS: (e.g, Ubuntu) Python version: (e.g., Python 3.8.10) SDK version: (e.g., 1.25.0) API version: (e.g., 1.25.0)

What happened?

Same as reported in #3974 but for SumAggregation.

Steps to Reproduce

I'll add a test case that fails in main.

Expected Result

start_time_unix_nano being greater than the previous collected point time_unix_nano when there is a time delay between the two points and an empty collection in between them as well.

We should be doing this:

(T0, T1]
  - attributes: {verb = GET, status = 200}, count: 2, min: 50 (ms), max: 100 (ms)
  - attributes: {verb = GET, status = 500}, count: 1, min: 1 (ms), max: 1 (ms)
(T1, T2]
  - nothing since we don't have any Measurement received
(T2, T3]
  - attributes: {verb = GET, status = 500}, count: 2, min: 2 (ms), max: 5 (ms)

Actual Result

start_time_unix_nano being the same as the previous collected point time_unix_nano when there is a time delay between the two points and an empty collection in between them as well.

We are doing this:

(T0, T1]

  - attributes: {verb = GET, status = 200}, count: 2, min: 50 (ms), max: 100 (ms)

  - attributes: {verb = GET, status = 500}, count: 1, min: 1 (ms), max: 1 (ms)

(T1, T2]

  - nothing since we don't have any Measurement received

(T1, T3]

  - attributes: {verb = GET, status = 500}, count: 2, min: 2 (ms), max: 5 (ms)

Additional context

No response

Would you like to implement a fix?

None

ocelotl commented 1 day ago

Fixed in #4011