Repository navigation
Conversation
Pull request dashboard statusMerged · refreshed 2026-11-25 22:17 UTC Status above doesn't look right?
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8979 +/- ##
============================================
+ Coverage 90.45% 90.55% +0.09%
- Complexity 11181 11217 +36
============================================
Files 1032 1032
Lines 30507 30598 +91
Branches 3992 4009 +17
============================================
+ Hits 27595 27707 +112
+ Misses 1935 1914 -21
Partials 977 977 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
psx95
left a comment
There was a problem hiding this comment.
When registering the associated storage for metrics in SdkMeter, if a view has drop aggregation, then the storage for that is skipped. This could probably cause an issue in the intended functionality because opentelemetry-java evaluates each matching RegisteredView independently in SdkMeter and simply skips (continue) any view whose aggregation is Aggregation.drop(), registering both:
- InstrumentSelector("*") →
enabled = true - InstrumentSelector("my.unwanted.instrument") →
enabled = falseand this will not disable "my.unwanted.instrument" since the second view turns intoAggregation.drop()and is skipped by SdkMeter, while the first view (*) still registers a live MetricStorage for "my.unwanted.instrument".
IIUC, this is a key use-case of the spec, right?
7bbc2e1 to
e942aa3
Compare
dashpole
left a comment
There was a problem hiding this comment.
When registering the associated storage for metrics in
SdkMeter, if a view has drop aggregation, then the storage for that is skipped... IIUC, this is a key use-case of the spec, right?
In the Metrics SDK specification (Measurement processing), that difference comes down to view_matching_mode:
- In
view_matching_mode: independent(the default, and whatopentelemetry-javacurrently implements), each matchingViewis evaluated independently without merging across views—so just as registeringInstrumentSelector("*")(withDefaultAggregation) alongsideInstrumentSelector("my.unwanted.instrument")withAggregation.drop()still exports"my.unwanted.instrument"from the first wildcard view today,enabledonly controls the stream produced by that view. (Inindependentmode, you can disable all instruments by default withInstrumentSelector("*")->enabled = falseand selectively enableInstrumentSelector("my.wanted.instrument")->enabled = true.) - Overriding
InstrumentSelector("*")->enabled = truewith a subsequentInstrumentSelector("my.unwanted.instrument")->enabled = falseis supported underview_matching_mode: composable(open-telemetry/opentelemetry-specification#5173), which merges matching views with the same stream name in registration order using last-wins precedence forenabled,aggregation,description, andaggregation_cardinality_limit.
e942aa3 to
1eb12d5
Compare
This comment has been minimized.
This comment has been minimized.
|
/dashboard route:reviewers |
|
@dashpole, this pull request was routed to reviewers. The handoff remains active across pushes until newer actionable human feedback arrives. Top-level feedback through this request will not return; unresolved review threads remain open. |
…dMetricsApiUsageTest
…g View enabled=false
1eb12d5 to
a40dbba
Compare
…se along with an aggregation
There was a problem hiding this comment.
This looks good. Thanks!
I did push two commits, to improve the readability of the OptInAdviceTest, and to add a TODO to potentially reject Views at construction time which specify enabled=false along with an aggregation, since this is not useful to specify.
Summary
Implements the experimental
OptIninstrument advisory parameter andViewenabledstream configuration defined in open-telemetry/opentelemetry-specification#4809:opentelemetry-api-incubator):setOptInAdvice(boolean)(default no-op) to all 8Extended*Builderinterfaces (ExtendedDoubleCounterBuilder,ExtendedDoubleGaugeBuilder,ExtendedDoubleHistogramBuilder,ExtendedDoubleUpDownCounterBuilder,ExtendedLongCounterBuilder,ExtendedLongGaugeBuilder,ExtendedLongHistogramBuilder,ExtendedLongUpDownCounterBuilder).opentelemetry-sdk-metrics):isOptIn()/setOptIn(boolean)to internalAdvice/AdviceBuilderand wiressetOptInAdvice(boolean)across allExtendedSdk*Builderimplementations (preservingoptInacross.ofDoubles()/.ofLongs()builder swaps).ViewBuilder#setEnabled(boolean)andView#getEnabled(), exposed experimentally viaSdkMeterProviderUtil#setEnabled(ViewBuilder, boolean).ViewRegistry#findViewsso that:OptIn=trueuseAggregation.drop()by default when no view matches or when a matching view does not setenabled=true.enabled=falseuseAggregation.drop()regardless of the view's configured aggregation.enabled=trueenableOptIn=trueinstruments while still respecting other instrument advisory parameters (AttributesandExplicitBucketBoundaries) unless overridden by the view.