metrics: add experimental view_matching_mode (composable metric views) support

Đang mở
#5,894 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
observability

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
2.7k
Fork
1.1k
Merge trung bình
3 ngày 12 giờ
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của open-telemetry/opentelemetry-python

Tất cả issue của open-telemetry/opentelemetry-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.