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

try {
metricData = collectionRegistration.collectAllMetrics();
} catch (Throwable t) {
error = t.getClass().getName();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is actually possible in practice

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 85.10638% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.18%. Comparing base (b56bc54) to head (b3915cf).

Files with missing lines Patch % Lines
...metry/sdk/metrics/export/PeriodicMetricReader.java 82.35% 3 Missing ⚠️
...dk/metrics/export/MetricReaderInstrumentation.java 88.88% 1 Missing and 1 partial ⚠️
...try/sdk/metrics/internal/SdkMeterProviderUtil.java 75.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8038      +/-   ##
============================================
+ Coverage     90.16%   90.18%   +0.01%     
- Complexity     7478     7485       +7     
============================================
  Files           834      835       +1     
  Lines         22559    22602      +43     
  Branches       2239     2241       +2     
============================================
+ Hits          20341    20384      +43     
- Misses         1515     1518       +3     
+ Partials        703      700       -3     

☔ 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.

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.

1 participant