Repository navigation
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-11-02 18:30 UTC Move out of draft to request review. Status above doesn't look right?
|
20c946f to
c55cce7
Compare
c55cce7 to
10ba62b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Disabled streams still create real per-attribute aggregations instead of using the resolved aggregation factory, incurring unnecessary aggregation and exemplar-sampling costs despite discarding their output.
1 open issue
Review effort: Balanced
|
Thanks for adding this. FYI, we still have a PR in-progress (#5444) for adding advisory attributes and we have been going back and forth a bit on how we can do this without introducing API breakage. #5444 makes several sweeping changes to how we handle advisory attributes, so it is probably best to wait for #5444 to get merged before proceeding here. |
771fa2e to
8fa1568
Compare
8fa1568 to
d4a05fe
Compare
Sounds good, I will wait for #5444 to merge before proceeding here. |
Thanks! We'll try to wrap this up ASAP to not block you. |

Note: This PR is blocked on #5444 and should wait until after it merges to be reviewed.
Description
Implements experimental support for the Metrics API
OptIninstrument advisory parameter (_opt_in_advisory: bool | None = None) and the Metrics SDKViewenabledconfiguration parameter (enabled: bool | None = None) per open-telemetry/opentelemetry-specification#4809 (tracking issue: open-telemetry/opentelemetry-specification#5384).Summary of Changes
opentelemetry-api:_MetricsAdvisory(retaining_MetricsHistogramAdvisoryas an alias) to supportopt_in: bool | None = Nonealongsideexplicit_bucket_boundaries._validate_opt_in_advisoryto validate that_opt_in_advisoryis abool(logging a warning and ignoring invalid values).*, _opt_in_advisory: bool | None = NonetoMeter.create_*,_ProxyMeter.create_*,NoOpMeter.create_*, and instrument constructors across all 7 metric instrument types (Counter,UpDownCounter,Histogram,Gauge,ObservableCounter,ObservableUpDownCounter,ObservableGauge), forwarding_opt_in_advisorywhen_ProxyMeterupgrades to a realMeter._MetricsAdvisoryinMeter._register_instrumentduplicate instrument conflict checks across all instrument types.opentelemetry-sdk:_opt_in_advisorythroughMeter.create_*and SDK instrument classes (_Synchronous,_Asynchronous,_Histogram).enabled: bool | None = NonetoView.__init__._ViewInstrumentMatchso that:_opt_in_advisory=Truedefault toDropAggregation()unless matched by aViewwithenabled=True.Viewwithenabled=Falseresolves toDropAggregation()regardless ofopt_inoraggregation.Viewwithenabled=Trueenablesopt_ininstruments using the view's configuredaggregation(or the instrument's default aggregation whenDefaultAggregationis used).MetricReaderStorage._check_view_instrument_compatibilitywhenview._enabled is False, and avoided false-positive metric identity conflict warnings when either stream uses_DropAggregation.How Has This Been Tested?
opentelemetry-api/tests/metrics/test_meter.pyopentelemetry-api/tests/metrics/test_meter_provider.pyopentelemetry-sdk/tests/metrics/test_view.pyopentelemetry-sdk/tests/metrics/test_metrics.pyopentelemetry-sdk/tests/metrics/test_metric_reader_storage.pyopentelemetry-sdk/tests/metrics/integration_test/test_opt_in_and_view_enabled.pycovering all 7 instrument types with_opt_in_advisory,View(enabled=True/False/None), multiple matching views, and_ProxyMeterupgrade forwarding.