Conversation
…attribute labels prometheus client-go rejects exemplars whose combined label runes exceed ExemplarMaxRunes (128). addExemplars previously let that error propagate and dropped every exemplar for the data point when the limit was hit, even though the trace and span ID labels alone are well within the limit. Instead, drop the filtered-attribute-derived labels and keep the trace and span IDs when the combined labels would exceed the limit, logging a warning so the truncation is visible. Fixes open-telemetry#6718
om7057
requested review from
MrAlias,
XSAM,
dashpole,
dmathieu,
flc1125,
pellared and
ps-mir
as code owners
September 26, 2026 18:37
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9031 +/- ##
=====================================
Coverage 89.1% 89.1%
=====================================
Files 338 338
Lines 22274 22287 +13
=====================================
+ Hits 19854 19867 +13
Misses 2420 2420
🚀 New features to boost your workflow:
|
kijimad
reviewed
Sep 28, 2026
| - Retain instrument advisory attributes (`metric/x.WithDefaultAttributes`) when a matching View does not specify an attribute filter in `go.opentelemetry.io/otel/sdk/metric`. (#8859) | ||
| - Ignore HTTP URL paths when building OTLP/gRPC metric exporter targets from `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, while preserving `unix://` and `unix-abstract://` targets; treat `unix-abstract://` endpoints as insecure in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8862) | ||
| - Ignore HTTP(S) paths when deriving gRPC trace exporter endpoints from `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#8852) | ||
| - Preserve exemplar trace and span IDs in `go.opentelemetry.io/otel/exporters/prometheus` by dropping filtered attribute labels instead of the whole exemplar when the combined exemplar labels would exceed the prometheus client-go limit. |
Contributor
Author
|
Good catch, added the PR number. |
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.
Summary
Fixes #6718.
prometheus client-go rejects exemplars whose combined label runes exceed
prometheus.ExemplarMaxRunes(128).addExemplarslet that error propagate up fromprometheus.NewMetricWithExemplarsand dropped every exemplar for the data point when the limit was hit, even though the trace and span ID labels alone are well within the limit and are the most valuable part of an exemplar.This checks each exemplar's combined label length against the limit before building the exemplar. When it would exceed the limit, the filtered-attribute-derived labels are dropped and only the trace and span IDs are kept, with a warning logged via
global.Warnso the truncation is visible instead of silent.Test plan
TestExemplarsExceedingLabelLimit, verified it fails without the fix (exemplar dropped entirely) and passes with it (trace/span IDs preserved, filtered attributes dropped).go test ./... -racemake precommit