Add configurable unique_tag_ratio to OTel metric Contexts#1868
Add configurable unique_tag_ratio to OTel metric Contexts#1868ArunPiduguDD wants to merge 3 commits intomainfrom
Conversation
Exposes the previously hardcoded UNIQUE_TAG_RATIO (0.75) as a user-configurable field on the Contexts struct, allowing control over attribute cardinality per metric. Set to 1.0 for fully unique attributes on every emission. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e0b6bc0dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub attributes_per_metric: ConfRange<u8>, | ||
| /// Fraction of attributes that are unique vs. reused. 1.0 means every | ||
| /// attribute is unique; 0.01 means nearly all attributes are reused from | ||
| /// the existing pool. Valid range: 0.01–1.0. |
There was a problem hiding this comment.
Replace the non-ASCII dash in documentation
The repository instructions in /workspace/lading/AGENTS.md require "US-ASCII only - no Unicode characters in code or documentation", but this new doc comment uses a Unicode en dash in 0.01–1.0. In contexts where validation enforces that rule, this otherwise harmless documentation change can fail the required ci/validate; use an ASCII hyphen/range wording instead.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Summary
unique_tag_ratio: f32field to theContextsstruct in the OpenTelemetry metrics payload generatorUNIQUE_TAG_RATIO = 0.75constant intemplates.rswith the user-supplied value0.01–1.00.75(preserving existing behavior)Usage
Test plan
cargo test -p lading-payload)cargo build -p lading-payload)🤖 Generated with Claude Code