Add experimental view_matching_mode (composable metric views) support

Open
#9,013 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@rooks-ns is already working on this.

Since Nov 8, 2026.

  • #9020 by @rooks-ns — open

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

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:

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_mode setter on SdkMeterProviderBuilder via SdkMeterProviderUtil (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 composable View grouping and stream merging in opentelemetry-sdk-metrics (ViewBuilder / View and ViewRegistry) per the specification:
    • Form a stream group for each distinct configured View name containing matching Views with that name plus all matching Views with name == null (or a single default-named group if no matching View sets name).
    • Track explicitly configured ViewBuilder properties (distinguishing unset properties from ViewBuilder's default field values in ViewBuilder.java#L26-L30) to apply atomic last-wins precedence across non-attribute_keys stream settings, falling back per-aspect to the preceding valid View in the group (or default) with a warning on semantic errors rather than discarding the entire RegisteredView.
    • Compose specified attribute_keys predicates via logical AND, and override instrument advisory parameters only for aspects configured by matching Views in the group (falling back to instrument advisory parameters otherwise).
  • Wire MeterProviderModelAccessor.getViewMatchingMode(model) in MeterProviderFactory.create(...).
Additional Context
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
4d 3h
Merged PRs (30d)
49

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.