Skip to content

Commit

Permalink
Fix exemplar for opentel to use traceId instead of spanId and sample …
Browse files Browse the repository at this point in the history
…only if trace is sampled.

Signed-off-by: jianwu <[email protected]>
  • Loading branch information
jianwu committed Mar 9, 2023
1 parent 3dea8cf commit ab85c5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/extprom/http/instrument_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit ab85c5e

Please sign in to comment.