Tracer Version(s)
v2.0.0
Go Version(s)
go v1.24.3
Bug Report
We used to use the ChildOf option to inject a parent context extracted from a message or an HTTP request but the option is not deprecated in favor of StartChild but we cannot instantiate the parent span from the parent context and we end up doing this:
if parentSpan, _ := tracer.Extract(MessageCarrier{msg}); parentSpan != nil {
opts = append(opts, tracer.WithStartSpanConfig(&tracer.StartSpanConfig{
Parent: parentSpan,
}))
}
But that seems overkill. I can't find a different way so I'm assuming that's not the right approach but then I have no idea what the right one is.
Or a Parent option when starting the span would be possible ?
Reproduction Code
opts := []tracer.StartSpanOption{
tracer.Tag("messaging.topic", topic),
tracer.Tag(ext.SpanKind, ext.SpanKindConsumer),
tracer.SpanType(ext.SpanTypeMessageConsumer),
}
if parentSpan, _ := tracer.Extract(MessageCarrier{msg}); parentSpan != nil {
opts = append(opts, tracer.WithStartSpanConfig(&tracer.StartSpanConfig{
Parent: parentSpan,
}))
}
span, ctx := tracer.StartSpanFromContext(ctx, "queue.consume", opts...)
defer func() {
span.Finish(tracer.WithError(err))
}()
Error Logs
No response
Go Env Output
No response
Tracer Version(s)
v2.0.0
Go Version(s)
go v1.24.3
Bug Report
We used to use the
ChildOfoption to inject a parent context extracted from a message or an HTTP request but the option is not deprecated in favor ofStartChildbut we cannot instantiate the parent span from the parent context and we end up doing this:But that seems overkill. I can't find a different way so I'm assuming that's not the right approach but then I have no idea what the right one is.
Or a
Parentoption when starting the span would be possible ?Reproduction Code
Error Logs
No response
Go Env Output
No response