opentelemetry-cpp
opentelemetry-cpp copied to clipboard
[Metrics SDK] Metric aggregation temporality controls
Fixes #1339
Changes
As preferred aggregation temporality concept is removed from specs, and is made as function of instrument-kind (see section here - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#metricreader) , following changes are done -
- Modify
GetAggregationTemporality()method in MetricReader. The methods now take in instrument type/kind, that lets exporter find which temporality to use based on the instrument. - Add
GetAggregationTemporality()method in MetricExporter. This method takes the instrument type/kind, and returns the correct temporality to use based on the exporter used -- OTLP exporter can be configured with a preferred temporality
- Prometheus only uses cumulative (as it doesn't support delta).
For significant contributions please make sure you have completed the following items:
- [ ]
CHANGELOG.mdupdated for non-trivial changes - [x] Unit tests have been added
- [x] Changes in public API reviewed
Codecov Report
Merging #1541 (b06345c) into main (124b198) will decrease coverage by
0.04%. The diff coverage is57.15%.
@@ Coverage Diff @@
## main #1541 +/- ##
==========================================
- Coverage 83.96% 83.93% -0.03%
==========================================
Files 156 156
Lines 4905 4908 +3
==========================================
+ Hits 4118 4119 +1
- Misses 787 789 +2
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...dk/include/opentelemetry/sdk/metrics/instruments.h | 0.00% <ø> (ø) |
|
| ...nclude/opentelemetry/sdk/metrics/metric_exporter.h | 100.00% <ø> (ø) |
|
| .../include/opentelemetry/sdk/metrics/metric_reader.h | 50.00% <ø> (ø) |
|
| sdk/src/metrics/state/metric_collector.cc | 50.00% <0.00%> (ø) |
|
| ...metrics/export/periodic_exporting_metric_reader.cc | 73.92% <50.00%> (-3.35%) |
:arrow_down: |
| exporters/ostream/src/metric_exporter.cc | 92.13% <66.67%> (-1.31%) |
:arrow_down: |
| sdk/src/metrics/metric_reader.cc | 59.38% <100.00%> (-4.51%) |
:arrow_down: |
| sdk/src/metrics/state/temporal_metric_storage.cc | 93.23% <100.00%> (ø) |
|
| ext/src/http/client/curl/http_client_curl.cc | 81.44% <0.00%> (+0.38%) |
:arrow_up: |
| sdk/src/trace/batch_span_processor.cc | 91.41% <0.00%> (+0.79%) |
:arrow_up: |
@lalitb can you please resolve the merging conflict?
@lalitb can you please resolve the merging conflict?
Fixed. Thanks.