Skip to content

Commit

Permalink
fix(ddtrace/tracer): avoid panic on nil spancontext on Extract
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Dec 20, 2024
1 parent 5d9fa48 commit bf84d28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ddtrace/tracer/textmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (p *chainedPropagator) Extract(carrier interface{}) (*SpanContext, error) {
overrideDatadogParentID(ctx2, extractedCtx2, ddCtx)
}
}
} else { // Trace IDs do not match - create span links
} else if extractedCtx2 != nil { // Trace IDs do not match - create span links
link := SpanLink{TraceID: extractedCtx2.TraceIDLower(), SpanID: extractedCtx2.SpanID(), TraceIDHigh: extractedCtx2.TraceIDUpper(), Attributes: map[string]string{"reason": "terminated_context", "context_headers": getPropagatorName(v)}}
if trace := extractedCtx2.trace; trace != nil {
if flags := uint32(*trace.priority); flags > 0 { // Set the flags based on the sampling priority
Expand Down

0 comments on commit bf84d28

Please sign in to comment.