Skip to content

Widen scopes_per_resource and metrics_per_scope to u16 in OTel metrics config#1869

Open
ArunPiduguDD wants to merge 1 commit intomainfrom
arun.pidugu/otel-metrics-widen-context-fields
Open

Widen scopes_per_resource and metrics_per_scope to u16 in OTel metrics config#1869
ArunPiduguDD wants to merge 1 commit intomainfrom
arun.pidugu/otel-metrics-widen-context-fields

Conversation

@ArunPiduguDD
Copy link
Copy Markdown

Summary

  • Widens scopes_per_resource and metrics_per_scope in lading_payload::opentelemetry::metric::Contexts from ConfRange<u8> to ConfRange<u16>
  • Updates validation arithmetic to use saturating_mul so u16 * u16 doesn't overflow u32
  • Updates proptest ranges to use u16 types

Why

The previous u8 typing capped per-emission cardinality at 255 × 255 = 65,025 unique metric sites per resource. With this change, that ceiling rises to ~4.3 billion, which fits within the existing total_contexts: u32 envelope. This unblocks high-cardinality OTel load tests that need many distinct metric time series per emission.

The attributes_per_* fields are intentionally left as u8 — 255 tags per metric/resource/scope is plenty, and widening them would cascade into the shared TagGenerator (which OTel logs also depends on).

Test plan

  • All existing OTel metric tests pass (cargo test -p lading-payload --lib opentelemetry::metric)
  • Workspace builds clean (cargo build --workspace)

🤖 Generated with Claude Code

The previous u8 typing capped the per-emission cardinality at 255×255 =
65,025 unique metric sites per resource. Widening these two fields to
u16 raises the ceiling to ~4.3B, which fits within the existing
total_contexts: u32 envelope. Validation arithmetic uses
saturating_mul to avoid u32 overflow at the upper bound.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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