Skip to content

Commit

Permalink
fix(contrib/cloud.google.com/go/pubsub.v1): don't panic on checking f…
Browse files Browse the repository at this point in the history
…or span links
  • Loading branch information
darccio committed Dec 16, 2024
1 parent 6b5cf69 commit 2ea4002
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/cloud.google.com/go/pubsub.v1/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TraceReceiveFunc(s Subscription, opts ...Option) func(ctx context.Context,
opts = append(opts, tracer.Measured())
}
// If there are span links as a result of context extraction, add them as a StartSpanOption
if parentSpanCtx.SpanLinks() != nil {
if parentSpanCtx != nil && parentSpanCtx.SpanLinks() != nil {
opts = append(opts, tracer.WithSpanLinks(parentSpanCtx.SpanLinks()))
}
span, ctx := tracer.StartSpanFromContext(ctx, cfg.receiveSpanName, opts...)
Expand Down

0 comments on commit 2ea4002

Please sign in to comment.