Widen scopes_per_resource and metrics_per_scope to u16 in OTel metrics config#1869
Open
ArunPiduguDD wants to merge 1 commit intomainfrom
Open
Widen scopes_per_resource and metrics_per_scope to u16 in OTel metrics config#1869ArunPiduguDD wants to merge 1 commit intomainfrom
ArunPiduguDD wants to merge 1 commit intomainfrom
Conversation
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>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scopes_per_resourceandmetrics_per_scopeinlading_payload::opentelemetry::metric::ContextsfromConfRange<u8>toConfRange<u16>saturating_mulsou16 * u16doesn't overflowu32u16typesWhy
The previous
u8typing 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 existingtotal_contexts: u32envelope. This unblocks high-cardinality OTel load tests that need many distinct metric time series per emission.The
attributes_per_*fields are intentionally left asu8— 255 tags per metric/resource/scope is plenty, and widening them would cascade into the sharedTagGenerator(which OTel logs also depends on).Test plan
cargo test -p lading-payload --lib opentelemetry::metric)cargo build --workspace)🤖 Generated with Claude Code