Skip to content

feat: add experimental view_matching_mode to meter provider - #666

Open
dashpole wants to merge 6 commits into
open-telemetry:mainfrom
dashpole:add-view-matching-mode
Open

feat: add experimental view_matching_mode to meter provider#666
dashpole wants to merge 6 commits into
open-telemetry:mainfrom
dashpole:add-view-matching-mode

Conversation

@dashpole

Copy link
Copy Markdown
Contributor

Implements composable View matching configuration in support of open-telemetry/opentelemetry-specification#5173.

Adds experimental meter_provider.view_matching_mode/development enum property, with ['independent' default, 'composable'] as values

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an experimental meter_provider.view_matching_mode/development configuration option to support composable View matching (per spec work), and propagates it through the schema outputs, docs, and language support metadata.

Changes:

  • Add view_matching_mode/development to the MeterProvider schema (enum values: independent, composable) and regenerate JSON schema + docs.
  • Update per-language support metadata to mark the new property as not_implemented.
  • Add a validator shelltest for invalid values and update an example configuration to demonstrate usage.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
validator/shelltests/invalid_view_matching_mode.yaml New negative test input using an invalid view_matching_mode/development value.
validator/shelltests/invalid_view_matching_mode.test Expected validator output for the invalid value case.
schema/meter_provider.yaml Introduces view_matching_mode/development on MeterProvider.
schema/meta_schema_language_php.yaml Marks the new MeterProvider property as not_implemented for PHP.
schema/meta_schema_language_js.yaml Marks the new MeterProvider property as not_implemented for JS.
schema/meta_schema_language_java.yaml Marks the new MeterProvider property as not_implemented for Java.
schema/meta_schema_language_go.yaml Marks the new MeterProvider property as not_implemented for Go.
schema/meta_schema_language_cpp.yaml Marks the new MeterProvider property as not_implemented for C++.
schema-docs.md Documents the new property and its language support status (generated).
opentelemetry_configuration.json Adds the generated JSON schema for the new property.
language-support-status.md Updates generated language support tables to include the new property.
examples/otel-sdk-config.yaml Demonstrates view_matching_mode/development: composable plus views.
CHANGELOG.md Notes the new property in Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread schema/meter_provider.yaml Outdated
Comment thread opentelemetry_configuration.json Outdated
Comment thread schema-docs.md Outdated
Comment thread schema-docs.md Outdated
Comment thread CHANGELOG.md Outdated
@dashpole
dashpole force-pushed the add-view-matching-mode branch from 5225b23 to 0e8eb3d Compare June 23, 2026 18:51
@dashpole dashpole changed the title feat: add experimental view_matching mode to meter provider feat: add experimental view_matching_mode to meter provider Jun 23, 2026
Comment thread examples/otel-sdk-config.yaml Outdated
Comment thread schema/meter_provider.yaml Outdated
@dashpole
dashpole force-pushed the add-view-matching-mode branch from 0e8eb3d to fb9dda0 Compare July 23, 2026 15:40
Comment thread schema-docs.md

@jack-berg jack-berg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content looks good. Still need to fix schema-docs.md, mark "ready for review", and get more approvals on the spec PR. But setting aside that, the schema changes look good here.

pull Bot pushed a commit to MC-MAGA/opentelemetry-specification that referenced this pull request Aug 7, 2026
Fixes open-telemetry#5013

Following-up after this came up in the spec SIG meeting on 6/23.

### Summary
Introduces an opt-in `view_matching_mode` configuration parameter on
`MeterProvider` to support merging multiple Views that match the same
Instrument.

### API

*  Adds `view_matching_mode` to `MeterProvider` with two modes:
* `independent`: (Default) Maintains existing behavior where matching
Views create separate streams independently.
* `composable`: Merges matching Views into a single stream unless they
configure different stream `name`s.

### Composable merge rules

* For `name`, `description`, `aggregation`, `exemplar_reservoir`, and
`aggregation_cardinality_limit`, **last-wins precedence** applies based
on View registration order.
  * `attribute_keys`' `included` and `excluded` sets are merged.
* `include` keeps only keys present in **all include-lists** (set
intersection).
* `exclude` drops keys listed in **any of the exclude-lists** (set
union).

### Declarative Config example

```yaml
meter_provider:
  view_matching_mode: composable
  views:
    # 1. Specific override: Rename histogram and use sum aggregation
    - selector:
        meter_name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
        instrument_name: http.client.request.duration
      stream:
        name: http.client.latency
        aggregation:
          sum: {}
    # 2. Scope policy: Drop status code from all metrics in otelhttp scope
    - selector:
        meter_name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
      stream:
        attribute_keys:
          exclude:
            - http.response.status_code
```

### Alternatives Considered
* Considered a boolean (`composable_views_enabled: true`) or alternative
naming (`composable_views`), but opted for an explicit enum
(`view_matching_mode`) to support future extensibility.
* Considered **first-wins** ordering because first-wins is used more
often in the specification, but aligned on **last-wins** to match
reviewer intuition for how it should work.
* Considered atomic whole-field last-wins for `attribute_keys`, but
opted for set composition so global governance policies (e.g., dropping
sensitive PII) layer safely with specific View overrides.
* Other alternatives are listed in open-telemetry#5013

### Checklist

* [x] Related issues #
* [x] Related [OTEP(s)](https://github.com/open-telemetry/oteps) #
* [x] Links to the prototypes (when adding or changing features):
open-telemetry/opentelemetry-go#8510
* [x]
[`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md)
file updated for non-trivial changes
* For trivial changes, include `[chore]` in the PR title to skip the
changelog check
* [x] [Spec compliance
matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix/template.yaml)
updated if necessary:
* [x] [Declarative config data
model](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/data-model.md#overview)
is updated if SDK config surface is changed:
open-telemetry/opentelemetry-configuration#666

@open-telemetry/specs-metrics-approvers

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
…property

Implements composable View matching configuration in support of open-telemetry/opentelemetry-specification#5173.
- Adds experimental meter_provider.view_matching_mode/development property ('independent' default, 'composable')
- Marks view_matching_mode/development as not_implemented in language support status matrix
- Updates existing otel-sdk-config.yaml example and adds validator shelltest edge case
@dashpole
dashpole force-pushed the add-view-matching-mode branch from acb8776 to 0f7a679 Compare August 13, 2026 18:59
@dashpole
dashpole marked this pull request as ready for review August 13, 2026 19:27
@dashpole
dashpole requested a review from a team as a code owner August 13, 2026 19:27
Comment thread snippets/MeterProvider_composable_views.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants