Add experimental view_matching_mode (composable metric views) support
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- backend-api-design, databases
Research direction
Start with ViewRegistry.findViews(...) in sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistry.java, then read the specification sections linked in the issue for stream grouping and merging rules. Inspect ViewBuilder and View for configured-property tracking, and SdkMeterProviderUtil for the experimental setter pattern; wire MeterProviderModelAccessor.getViewMatchingMode(model) from MeterProviderFactory.create(...). Done means composable matching, precedence, attribute filtering, and advisory fallback follow the specification while independent remains the default.
Written by the indexing model from the issue text.
Description
Description
The OpenTelemetry Metrics SDK specification defines an experimental (Development) view_matching_mode configuration parameter (independent vs. composable) on MeterProvider to compose multiple matching Views (for example, combining a broad policy View that filters attributes or disables instruments with an instrument-specific View that customizes aggregation) into merged metric streams rather than emitting duplicate/conflicting streams (specification/metrics/sdk.md#L519-L543, introduced in https://github.com/open-telemetry/opentelemetry-specification/pull/5173).
Currently in opentelemetry-java:
ViewRegistry.findViews(...)only implementsindependentmatching, evaluating each matchingViewas a separate stream: https://github.com/open-telemetry/opentelemetry-java/blob/f02bddc4091f56d68b60b4c433afcec64c8d97b9/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistry.java#L99-L155opentelemetry-sdk-extension-declarative-config(:sdk-extensions:declarative-config) includes theview_matching_mode/developmentmodel accessor (MeterProviderModelAccessor.getViewMatchingMode), butMeterProviderFactory.create(...)does not yet wire it toSdkMeterProviderBuilder:- https://github.com/open-telemetry/opentelemetry-java/blob/f02bddc4091f56d68b60b4c433afcec64c8d97b9/sdk-extensions/declarative-config/src/main/java/io/opentelemetry/sdk/autoconfigure/declarativeconfig/model/internal/MeterProviderModelAccessor.java#L52-L58
- https://github.com/open-telemetry/opentelemetry-java/blob/f02bddc4091f56d68b60b4c433afcec64c8d97b9/sdk-extensions/declarative-config/src/main/java/io/opentelemetry/sdk/autoconfigure/declarativeconfig/MeterProviderFactory.java#L40-L107
Proposal
Implement experimental support for view_matching_mode (independent default, composable opt-in) in opentelemetry-sdk-metrics and wire it in opentelemetry-sdk-extension-declarative-config:
- Expose an experimental
view_matching_modesetter onSdkMeterProviderBuilderviaSdkMeterProviderUtil(following the pattern in https://github.com/open-telemetry/opentelemetry-java/blob/f02bddc4091f56d68b60b4c433afcec64c8d97b9/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/SdkMeterProviderUtil.java#L70-L84). - Implement
composableView grouping and stream merging inopentelemetry-sdk-metrics(ViewBuilder/ViewandViewRegistry) per the specification:- Form a stream group for each distinct configured
Viewnamecontaining matchingViews with thatnameplus all matchingViews withname == null(or a single default-named group if no matchingViewsetsname). - Track explicitly configured
ViewBuilderproperties (distinguishing unset properties fromViewBuilder's default field values inViewBuilder.java#L26-L30) to apply atomic last-wins precedence across non-attribute_keysstream settings, falling back per-aspect to the preceding validViewin the group (or default) with a warning on semantic errors rather than discarding the entireRegisteredView. - Compose specified
attribute_keyspredicates via logical AND, and override instrument advisory parameters only for aspects configured by matchingViews in the group (falling back to instrument advisory parameters otherwise).
- Form a stream group for each distinct configured
- Wire
MeterProviderModelAccessor.getViewMatchingMode(model)inMeterProviderFactory.create(...).
Additional Context
- Specification PR: https://github.com/open-telemetry/opentelemetry-specification/pull/5173 (open clarification PR: https://github.com/open-telemetry/opentelemetry-specification/pull/5414)
- Specification stabilization tracking issue: https://github.com/open-telemetry/opentelemetry-specification/issues/5385
- Declarative configuration schema PR: https://github.com/open-telemetry/opentelemetry-configuration/pull/666
- Reference Go prototype: https://github.com/open-telemetry/opentelemetry-go/pull/8510
- Related Java PR (
OptIninstrument advice andViewenabledconfiguration): https://github.com/open-telemetry/opentelemetry-java/pull/8979
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 49
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from open-telemetry/opentelemetry-java
-
Retry-After parser accepts invalid delay-seconds valuesPossibly taken @Dhruvraj-Rana claimed this today. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-telemetry/opentelemetry-java#9018 ·
Maintainers usually reply within 2 days
-
PrometheusComponentProvider promotes all resource attributes when resource_constant_labels is empty ({})Possibly taken @rooks-ns claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-java#9014 ·
Maintainers usually reply within 2 days
-
MetricReusableDataMarshaler passes MetricData count instead of data point count to otel.sdk.exporter.metric_data_point.{inflight,exported}Possibly taken @goutamadwant claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#9011 · 1 comment ·
Maintainers usually reply within 2 days
-
Fix `otel.sdk.log.created` counting semanticsPossibly taken @anuraaga claimed this 94 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#8688 ·
Maintainers usually reply within 2 days
-
Span/log processors and PeriodicMetricReader use static ComponentId, causing all instances to share otel.component.name "<type>/0"Possibly taken @goutamadwant claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
open-telemetry/opentelemetry-java#9012 ·
Maintainers usually reply within 2 days
All issues in open-telemetry/opentelemetry-java
Similar issues
-
Document and enforce pull request review guidelinesPossibly taken @dashorst claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
hermes-queue
Difficulty 1/5 Under an hour Newbie friendliness 72/100
chrisalunlloyd2-sudo/mindpalace#349 ·
Maintainers usually reply within 1 day
-
bug priority: medium Review effort [1-5]: 2 status: needs-triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
carlos-emr/carlos#5818 ·
Maintainers usually reply within 1 day
-
bug good first issue help wanted tooling
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
appmonster007/kmip-adapter#100 ·