Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] Update MetricProducer interface to match spec #3044

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

punya
Copy link
Member

@punya punya commented Sep 1, 2024

Following https://github.com/open-telemetry/opentelemetry-specification/blob/v1.36.0/specification/metrics/sdk.md#metricproducer.

Updates #1831

Changes

Updates MetricProducer to return a batch of metric points instead of receiving a callback.

  • According to the spec, Produce SHOULD also take a Resource parameter, but I have chosen not to do that (because existing implementations pull the resource from the metric context). I'm not familiar with this area so I'd appreciate any advice.

  • MetricFilter support isn't stable yet so I've kept it out of this initial PR.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.78%. Comparing base (497eaf4) to head (9d4f849).
Report is 133 commits behind head on main.

Files with missing lines Patch % Lines
sdk/src/metrics/state/metric_collector.cc 66.67% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3044      +/-   ##
==========================================
+ Coverage   87.12%   87.78%   +0.66%     
==========================================
  Files         200      195       -5     
  Lines        6109     5954     -155     
==========================================
- Hits         5322     5226      -96     
+ Misses        787      728      -59     
Files with missing lines Coverage Δ
...opentelemetry/sdk/metrics/export/metric_producer.h 100.00% <ø> (ø)
...opentelemetry/sdk/metrics/state/metric_collector.h 100.00% <ø> (ø)
sdk/src/metrics/metric_reader.cc 78.79% <100.00%> (ø)
sdk/src/metrics/state/metric_collector.cc 92.60% <66.67%> (-0.26%) ⬇️

... and 121 files with indirect coverage changes

@punya punya force-pushed the metric-producer branch 3 times, most recently from 4fb25f4 to c8c2c7a Compare September 1, 2024 19:55
@punya punya marked this pull request as ready for review September 1, 2024 21:16
@punya punya requested a review from a team September 1, 2024 21:16
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

Not a full review, just some preliminary comments.

sdk/src/metrics/metric_reader.cc Show resolved Hide resolved
@marcalff marcalff requested a review from a team as a code owner September 23, 2024 22:32
Copy link

netlify bot commented Sep 23, 2024

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 9d4f849
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/66f1ec7428e90b0008701540

@marcalff marcalff changed the title Update MetricProducer interface to match spec [SDK] Update MetricProducer interface to match spec Sep 27, 2024
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

@marcalff marcalff merged commit 7b82473 into open-telemetry:main Oct 1, 2024
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants