opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

[Metrics SDK] Metric aggregation temporality controls

Open lalitb opened this issue 3 years ago • 3 comments
trafficstars

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.md updated for non-trivial changes
  • [x] Unit tests have been added
  • [x] Changes in public API reviewed

lalitb avatar Aug 04 '22 02:08 lalitb

Codecov Report

Merging #1541 (b06345c) into main (124b198) will decrease coverage by 0.04%. The diff coverage is 57.15%.

Impacted file tree graph

@@            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:

codecov[bot] avatar Aug 04 '22 02:08 codecov[bot]

@lalitb can you please resolve the merging conflict?

ThomsonTan avatar Aug 05 '22 22:08 ThomsonTan

@lalitb can you please resolve the merging conflict?

Fixed. Thanks.

lalitb avatar Aug 05 '22 22:08 lalitb