Skip to content

fix: skip per-label limiter and sanitizer for info metrics - #6660

Merged
electron0zero merged 4 commits into
grafana:mainfrom
electron0zero:per_label_limit_labels
Mar 12, 2026
Merged

fix: skip per-label limiter and sanitizer for info metrics#6660
electron0zero merged 4 commits into
grafana:mainfrom
electron0zero:per_label_limit_labels

Conversation

@electron0zero

@electron0zero electron0zero commented Mar 12, 2026

Copy link
Copy Markdown
Member

What this PR does:

The PerLabelLimiter was tracking cardinality for ALL labels that passed through it, including resource attributes from target_info and host_info.

This caused the demand estimate metric to report way more label names instead of just the configured dimensions from span-metrics and service-graphs.

info metrics carry all resource attributes as labels and have high cardinality by design so we should not limit and sanitize info metrics.

Made changes to skip the span name drain sanitizer for info metrics as well.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
…fo metrics

The PerLabelLimiter was tracking cardinality for ALL labels that passed
through it, including resource attributes from target_info and host_info.

This caused the demand estimate metric to report way more label names instead
of just the configured dimensions from span-metrics and service-graphs.

info metrics carry all resource attributes as labels and have
high cardinality by design so we should not limit and sanitize info metrics.

Made chanegs to skip the span name drain sanitizer for these metrics as well.
@electron0zero

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

Add TestManagedRegistry_InfoMetricLabelsNotInDemandEstimate that pushes
data through both NewLabelBuilder (span-metrics) and NewInfoMetricLabelBuilder
(target_info, host_info), then asserts only span-metrics labels appear in
the tempo_metrics_generator_registry_label_cardinality_demand_estimate metric.
@electron0zero

Copy link
Copy Markdown
Member Author

@codex review again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@electron0zero
electron0zero merged commit 0032973 into grafana:main Mar 12, 2026
24 checks passed
@electron0zero
electron0zero deleted the per_label_limit_labels branch March 12, 2026 14:36
mattdurham pushed a commit to mattdurham/tempo that referenced this pull request Jun 18, 2026
)

* fix: skip per-label limiter and sanitizer for target_info and host_info metrics

The PerLabelLimiter was tracking cardinality for ALL labels that passed
through it, including resource attributes from target_info and host_info.

This caused the demand estimate metric to report way more label names instead
of just the configured dimensions from span-metrics and service-graphs.

info metrics carry all resource attributes as labels and have
high cardinality by design so we should not limit and sanitize info metrics.

Made chanegs to skip the span name drain sanitizer for these metrics as well.

* rename NewLabelBuilderWithoutLimiter -> NewInfoMetricLabelBuilder

* test: verify info metric labels are excluded from demand estimate

Add TestManagedRegistry_InfoMetricLabelsNotInDemandEstimate that pushes
data through both NewLabelBuilder (span-metrics) and NewInfoMetricLabelBuilder
(target_info, host_info), then asserts only span-metrics labels appear in
the tempo_metrics_generator_registry_label_cardinality_demand_estimate metric.

* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants