Skip to content

Conversation

@anuraaga
Copy link
Contributor

This adds the last SDK metric, for the metric reader. Been a while since previous PR since I forgot about it 😅

https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics/#metric-otelsdkmetric_readercollectionduration

@anuraaga anuraaga requested a review from a team as a code owner January 30, 2026 06:04

/**
* Sets the {@link MeterProvider} to export metrics about this {@link PeriodicMetricReader} to.
* Automatically called by the meter provide the reader is registered to.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't think of a reason to not do this

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.24%. Comparing base (b56bc54) to head (bcf2b2b).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...io/opentelemetry/sdk/metrics/SdkMeterProvider.java 83.33% 2 Missing ⚠️
...dk/metrics/export/MetricReaderInstrumentation.java 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8038      +/-   ##
============================================
+ Coverage     90.16%   90.24%   +0.07%     
- Complexity     7478     7608     +130     
============================================
  Files           834      839       +5     
  Lines         22559    22846     +287     
  Branches       2239     2276      +37     
============================================
+ Hits          20341    20618     +277     
- Misses         1515     1519       +4     
- Partials        703      709       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


private Scheduled() {}

void setMeterProvider(MeterProvider meterProvider) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
void setMeterProvider(MeterProvider meterProvider) {
private void setMeterProvider(MeterProvider meterProvider) {


/**
* Sets the {@link MeterProvider} to export metrics about this {@link PeriodicMetricReader} to.
* Automatically called by the meter provider the reader is registered to.
Copy link
Member

@jack-berg jack-berg Feb 5, 2026

Choose a reason for hiding this comment

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

Makes me think that SdkTracerProvider, SdkLoggerProvider should cascade set meter provider on all child components (i.e. BatchSpanProcessor, exporters, etc). Problem is, the setMeterProvider methods on child components are on the builders... Probably could have had something more elegant with some foresight. Too bad.

@jack-berg jack-berg merged commit adecf60 into open-telemetry:main Feb 10, 2026
27 checks passed
@otelbot
Copy link
Contributor

otelbot bot commented Feb 10, 2026

Thank you for your contribution @anuraaga! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

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