What are you trying to achieve?
In the SDK spec on DefaultAggregation, it suggests that for AsynchronousCounter a default SumAggregation is used for aggregation.
| Instrument Kind |
Selected Aggregation |
| Counter |
Sum Aggregation |
| Asynchronous Counter |
Sum Aggregation |
| UpDownCounter |
Sum Aggregation |
| Asynchrounous UpDownCounter |
Sum Aggregation |
| Asynchronous Gauge |
Last Value Aggregation |
| Histogram |
Histogram Aggregation |
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#default-aggregation
When implementing the SumAggregation for the asynchronous counter, I found that in the SumAggregation:
SumAggregation informs the SDK to collect:
The arithmetic sum of Measurement values.
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#sum-aggregation
Whilst to the asynchronous counter, the Measurement values mean:
The callback function is responsible for reporting the Measurements.
Note: Unlike Counter.Add() which takes the increment/delta value, the callback function reports the absolute value of the counter.
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter
That's been said, the Measurement values in asynchronous counters are absolute values and not increments. To SumAggregation, the arithmetic sum of Measurement values of asynchronous counters doesn't seem to be meaningful.
This issue also applies to the Asynchronous UpDownCounter.
What are you trying to achieve?
In the SDK spec on DefaultAggregation, it suggests that for AsynchronousCounter a default SumAggregation is used for aggregation.
When implementing the SumAggregation for the asynchronous counter, I found that in the SumAggregation:
Whilst to the asynchronous counter, the
Measurementvalues mean:That's been said, the
Measurementvalues in asynchronous counters are absolute values and not increments. To SumAggregation, the arithmetic sum ofMeasurementvalues of asynchronous counters doesn't seem to be meaningful.This issue also applies to the Asynchronous UpDownCounter.