Skip to content

Gate PeriodicMetricReader self-observability by internal telemetry version#8597

Open
Debashismitra01 wants to merge 1 commit into
open-telemetry:mainfrom
Debashismitra01:fix/metric-reader-self-observability-gating
Open

Gate PeriodicMetricReader self-observability by internal telemetry version#8597
Debashismitra01 wants to merge 1 commit into
open-telemetry:mainfrom
Debashismitra01:fix/metric-reader-self-observability-gating

Conversation

@Debashismitra01

Copy link
Copy Markdown
Contributor

What was changed

  • Added support for configuring PeriodicMetricReader with an InternalTelemetryVersion.
  • Updated MetricExporterConfiguration to propagate the configured telemetry version when creating PeriodicMetricReader.
  • Gated metric reader self-observability initialization based on the configured telemetry version.
  • Preserved existing SDK behavior by defaulting PeriodicMetricReaderBuilder to InternalTelemetryVersion.LATEST.

Why?

PeriodicMetricReader always emitted otel.sdk.metric_reader.collection.duration whenever a real MeterProvider was available, regardless of OTEL_EXPERIMENTAL_SDK_TELEMETRY_VERSION.

Tracing and logging already gate SDK self-observability using InternalTelemetryConfiguration.getVersion(config). This change aligns metric reader self-observability with the existing behavior while preserving the default behavior for direct SDK users.

Fixes #8566

@Debashismitra01 Debashismitra01 requested a review from a team as a code owner July 14, 2026 04:45
@otelbot otelbot Bot added the api-change Changes to public API surface area label Jul 14, 2026
@otelbot

otelbot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-sdk-metrics

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.63%. Comparing base (fef8fdb) to head (525244f).

Files with missing lines Patch % Lines
...metry/sdk/metrics/export/PeriodicMetricReader.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8597      +/-   ##
============================================
+ Coverage     91.62%   91.63%   +0.01%     
- Complexity    10321    10325       +4     
============================================
  Files          1013     1013              
  Lines         27287    27295       +8     
  Branches       3203     3203              
============================================
+ Hits          25001    25012      +11     
+ Misses         1559     1558       -1     
+ Partials        727      725       -2     

☔ View full report in Codecov by Harness.
📢 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

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PeriodicMetricReader emits otel.sdk.metric_reader.collection.duration unconditionally, bypassing the experimental self-observability opt-in

1 participant