Skip to content

Limit exemplar label characters to conform to Prometheus limits#8362

Open
anuq wants to merge 2 commits intoopen-telemetry:mainfrom
anuq:fix/prometheus-exemplar-label-length-limit
Open

Limit exemplar label characters to conform to Prometheus limits#8362
anuq wants to merge 2 commits intoopen-telemetry:mainfrom
anuq:fix/prometheus-exemplar-label-length-limit

Conversation

@anuq
Copy link
Copy Markdown
Contributor

@anuq anuq commented May 2, 2026

Fixes #6770
Limits exemplar label characters to Prometheus's 128 UTF-8 character maximum. When labels exceed this limit, filtered attributes are dropped while preserving trace_id and span_id for correlation.

Changes

  • Added EXEMPLAR_MAX_LABEL_SET_LENGTH constant (128 chars)
  • Modified convertExemplar() to check label set length and drop attributes if needed
  • Added helper method labelSetLength() to calculate total label character count
  • Added comprehensive tests for both within-limit and exceeding-limit scenarios

@anuq anuq requested a review from a team as a code owner May 2, 2026 13:15
@anuq anuq force-pushed the fix/prometheus-exemplar-label-length-limit branch from 6f05ab7 to a0627db Compare May 2, 2026 14:46
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.84%. Comparing base (1b207c6) to head (4291d57).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8362      +/-   ##
============================================
+ Coverage     90.82%   90.84%   +0.02%     
- Complexity     7927     7932       +5     
============================================
  Files           895      895              
  Lines         23872    23886      +14     
  Branches       2378     2381       +3     
============================================
+ Hits          21681    21700      +19     
+ Misses         1446     1442       -4     
+ Partials        745      744       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Limit prometheus exemplar label characters to conform to prometheus limits

1 participant