|
Thank you for your work on open telemetry I am trying to add instrumentation to my Go code. However in jaeger I see the issue I wanted to clarify, are nested spans in the same function supported? i.e. is it possible to do something like this? ctx, span := Tracer.Start(ctx, name)
defer span.End()
ctx, subspan := Tracer.Start(ctx, new_name)
defer subspan.End()When I looked at the docs here: https://opentelemetry.io/docs/languages/go/instrumentation/#create-nested-spans it seemed to show each span getting its own function. I suspect that this is since the ctx would overwrite the previous one? Is it the case that you theoretically can do multiple spans in the same function, but that results in difficulties with managing the ctx variable? i.e. if you overwrite the context things will fail? |
Replies: 1 comment 1 reply
|
There is no limitation on how many spans can be created in a function. You indeed can have children of parent span within the same function. In your example It looks like Jaeger does not have reference to a parent span. Make sure that span was correctly sent to the Jaeger backend. |
There is no limitation on how many spans can be created in a function. You indeed can have children of parent span within the same function.
In your example
new_namewill be a child ofnameas you have shown the code.It looks like Jaeger does not have reference to a parent span. Make sure that span was correctly sent to the Jaeger backend.