Limit exemplar label characters to conform to Prometheus limits#8362
Open
anuq wants to merge 8 commits into
Open
Limit exemplar label characters to conform to Prometheus limits#8362anuq wants to merge 8 commits into
anuq wants to merge 8 commits into
Conversation
6f05ab7 to
a0627db
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8362 +/- ##
============================================
+ Coverage 91.15% 91.18% +0.02%
- Complexity 7763 7768 +5
============================================
Files 881 881
Lines 23409 23425 +16
Branches 2331 2334 +3
============================================
+ Hits 21338 21359 +21
+ Misses 1376 1372 -4
+ Partials 695 694 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced May 4, 2026
Closed
psx95
reviewed
May 9, 2026
Addressed both suggestions: codePointCount instead of length() — Updated labelSetLength() to use String.codePointCount() so the limit is measured in Unicode code points, consistent with the OpenMetrics exemplar spec. (reference open-telemetry#6791) Parameterized tests — Consolidated the four exemplar label limit tests into a single @ParameterizedTest with @MethodSource, covering all four combinations (with/without span context × within/exceeding limit)
Addressed both suggestions: codePointCount instead of length() — Updated labelSetLength() to use String.codePointCount() so the limit is measured in Unicode code points, consistent with the OpenMetrics exemplar spec. (reference open-telemetry#6791) Parameterized tests — Consolidated the four exemplar label limit tests into a single @ParameterizedTest with @MethodSource, covering all four combinations (with/without span context × within/exceeding limit)
…github.com/anuq/opentelemetry-java into fix/prometheus-exemplar-label-length-limit # Conflicts: # exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverterTest.java
psx95
approved these changes
May 18, 2026
- Refactor exemplarLabelLimit test to use Named arguments and consistent naming - Replace unused String testName parameter with Named.of() for better test display - Rename "short" attribute key to "short_attr" for consistency with "long_attr"
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.
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