Skip to content

oss_11_m3_per_view_cardinality_limit#49

Open
ocelotl wants to merge 1 commit into
oss_11_m2_per_reader_cardinality_limitfrom
oss_11_m3_per_view_cardinality_limit
Open

oss_11_m3_per_view_cardinality_limit#49
ocelotl wants to merge 1 commit into
oss_11_m2_per_reader_cardinality_limitfrom
oss_11_m3_per_view_cardinality_limit

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #48

Per-View cardinality-limit override (Linear OSS-11, finding M3), the finest layer. Optional View(aggregation_cardinality_limit=...); precedence View > per-reader default (M2) > base default 2000 (M1), resolved centrally in _ViewInstrumentMatch.

Stacked on oss_11_m2_per_reader_cardinality_limit (PR #44) → its base. Retarget once M1/M2 merge. Full M1→M2→M3 chain: PR #17#44 ← this.

Validation: M3 delta scope contained to opentelemetry-sdk + changelog; full metrics suite 315 passed (M1/M2 tests intact).

Linear issue: https://linear.app/dash0/issue/OSS-11/m1-m3-metric-cardinality-limits-base-per-reader-per-view

@ocelotl

ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

🔒 Internal (dash0) — not for upstream.

@ocelotl

ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

📣 Public-facing draft — to be used for the upstream PR in open-telemetry/opentelemetry-python. No internal references; copy verbatim.

Title: Add per-View cardinality-limit override

What

Adds an optional aggregation_cardinality_limit parameter to the View class. When set, it caps the number of distinct attribute sets (metric points) tracked for the streams matched by that view, folding excess into the standard {"otel.metric.overflow": True} series.

Why

Completes the cardinality-limit configuration surface described by the metrics spec. Previously the limit could be set only globally (base default) or per-MetricReader; there was no way to tune an individual metric stream. This lets a single high-cardinality instrument be capped independently of the reader-wide default.

Precedence

View override > per-reader default > base default (2000). An unset View override falls through to the reader default and then the base default, so existing behavior is unchanged when the new parameter is not used. Precedence is resolved in one place (_ViewInstrumentMatch).

Spec

specification/metrics/sdk.md — Cardinality limits (per-instrument/View configuration). Mirrors the Java SDK's per-instrument cardinality-limit selection.

Builds on

The base default and per-reader default cardinality-limit changes.

Tests

New unit tests: a View with a small limit overflows at that limit; overrides a larger reader default; overrides an unset reader; unset View falls through to reader then base default. Full metrics suite passes (315), including base and per-reader cardinality tests.

@ocelotl
ocelotl force-pushed the oss_11_m2_per_reader_cardinality_limit branch from b2a00b4 to e579430 Compare July 22, 2026 13:41
@ocelotl
ocelotl force-pushed the oss_11_m3_per_view_cardinality_limit branch from b1eed52 to 52efb81 Compare July 22, 2026 13:41
Add an optional aggregation_cardinality_limit parameter to the View class
that overrides both the per-MetricReader default and the base default
cardinality limit for the metric streams matched by that view.

Precedence (finest wins): View override > per-reader default > base default
(2000). The value is threaded into the _ViewInstrumentMatch produced by the
view, so a view-configured limit governs overflow for its matched streams.

Builds on the base default and per-reader default cardinality limits.
@ocelotl
ocelotl force-pushed the oss_11_m3_per_view_cardinality_limit branch from 52efb81 to 7784ba2 Compare July 22, 2026 13:42
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.

1 participant