Skip to content

Add configurable unique_tag_ratio to OTel metric Contexts#1868

Open
ArunPiduguDD wants to merge 3 commits intomainfrom
arun.pidugu/otel-metrics-unique-tag-ratio
Open

Add configurable unique_tag_ratio to OTel metric Contexts#1868
ArunPiduguDD wants to merge 3 commits intomainfrom
arun.pidugu/otel-metrics-unique-tag-ratio

Conversation

@ArunPiduguDD
Copy link
Copy Markdown

Summary

  • Adds unique_tag_ratio: f32 field to the Contexts struct in the OpenTelemetry metrics payload generator
  • Replaces the hardcoded UNIQUE_TAG_RATIO = 0.75 constant in templates.rs with the user-supplied value
  • Validates the field is in the range 0.01–1.0
  • Defaults to 0.75 (preserving existing behavior)

Usage

contexts:
  unique_tag_ratio: 1.0  # every attribute is unique per emission

Test plan

  • All existing tests pass (cargo test -p lading-payload)
  • Build clean (cargo build -p lading-payload)

🤖 Generated with Claude Code

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>
@ArunPiduguDD ArunPiduguDD requested a review from a team as a code owner May 6, 2026 20:42
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

ArunPiduguDD and others added 2 commits May 6, 2026 21:08
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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