metrics: add experimental view_matching_mode (composable metric views) support

オープン
#5,894 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
observability

調査の方向性

Start with opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py and metrics/_internal/__init__.py, then read the matching logic in _handle_view_instrument_match and the MeterProvider configuration path. Review the linked specification sections and the related View implementation before deciding how to cover matching, precedence, attribute filters, and advisory parameters. Done means opt-in composable matching is implemented with the specified fallback and error behavior, while independent mode remains the default.

索引モデルが issue の本文から書いたものです。

説明

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 wildcard View that filters attribute_keys 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-sdk, MetricReaderStorage._handle_view_instrument_match(...) always evaluates matching Views independently, creating a separate _ViewInstrumentMatch stream for each matching View:

Proposal

Implement experimental support for view_matching_mode ("independent" default, "composable" opt-in) in opentelemetry-sdk:

  • Accept an experimental keyword-only _view_matching_mode parameter on MeterProvider.__init__(...) (following _meter_configurator in metrics/_internal/__init__.py#L440-L441) and thread it into SdkConfiguration / MetricReaderStorage, handling unsupported values per sdk.md#L179-L182 (either raising ValueError during initialization or warning and falling back to "independent").
  • When composable mode is configured:
    • Form a stream group for each distinct configured View name containing matching Views with that name plus all matching Views with name=None (or a single default-named group if no matching View sets name).
    • Apply atomic last-wins precedence in registration order across explicitly specified non-attribute_keys View settings (name, description, aggregation, exemplar_reservoir_factory, aggregation_cardinality_limit, and enabled from https://github.com/open-telemetry/opentelemetry-python/pull/5847 — distinguishing omitted None arguments for aggregation and exemplar_reservoir_factory in view.py#L165-L166 from explicit defaults such as DefaultAggregation()), 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 View.
    • Combine specified attribute_keys filters via logical AND (set intersection across non-None allow-lists on main; exclude-lists tracked in https://github.com/open-telemetry/opentelemetry-python/issues/5446), and override instrument advisory parameters only for aspects configured by matching Views in the group (falling back to instrument advisory parameters otherwise).
Additional Context
主要言語
Python
スター
2.7k
フォーク
1.1k
平均マージ
3日 12時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

open-telemetry/opentelemetry-python のほかの issue

open-telemetry/opentelemetry-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。