I have a question about the goroutine safety guarantees for jaeger + opentracing-go.
In my code I am using jaeger and set jaeger tracer as global tracer for opentracing-go API. And I have a following code block.
func xyz(ctx context.Context, ...) {
span, spanctx := opentracing.StartSpanFromContext(ctx, "xyz")
defer span.Finish()
span.LogFields(
log.String("event", "soft error"),
log.String("type", "cache timeout"),
log.Int("waited.millis", 1500))
...
go taskProcess(spanctx, ...)
}
func taskProcess(ctx context.Context, ...) {
span, spanctx := opentracing.StartSpanFromContext(ctx, "taskProcess")
defer span.Finish()
...
}
I am passing the span context to a goroutine function, and start a new span from that context. I am wondering if this is safe to do.
Looking forward to your reply.