diff --git a/CHANGELOG.md b/CHANGELOG.md index 955e47dcd0..194a6dc29b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#6172](https://github.com/thanos-io/thanos/pull/6172) query-frontend: return JSON formatted errors for invalid PromQL expression in the split by interval middleware. - [#6171](https://github.com/thanos-io/thanos/pull/6171) Store: fix error handling on limits. - [#6183](https://github.com/thanos-io/thanos/pull/6183) Receiver: fix off by one in multitsdb flush that will result in empty blocks if the head only contains one sample +- [#6197](https://github.com/thanos-io/thanos/pull/6197) Exemplar OTel: Fix exemplar for otel to use traceId instead of spanId and sample only if trace is sampled ### Changed - [#6168](https://github.com/thanos-io/thanos/pull/6168) Receiver: Make ketama hashring fail early when configured with number of nodes lower than the replication factor. diff --git a/pkg/extprom/http/instrument_server.go b/pkg/extprom/http/instrument_server.go index d06c5261dd..6c0e626267 100644 --- a/pkg/extprom/http/instrument_server.go +++ b/pkg/extprom/http/instrument_server.go @@ -97,8 +97,8 @@ func httpInstrumentationHandler(baseLabels prometheus.Labels, metrics *defaultMe // If OpenTracing span not found, try OTEL. if !OTfound { span := trace.SpanFromContext(r.Context()) - if span != nil { - traceID = span.SpanContext().SpanID().String() + if span != nil && span.SpanContext().IsSampled() { + traceID = span.SpanContext().TraceID().String() } }