Unable to Link spans with trace in a straightforward way. Get an AttributeError: 'Context' object has no attribute 'trace_id' #3470
Unanswered
kchawla-pi
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Adding links to existing spans is not yet supported, it was introduced to the spec here: https://github.com/open-telemetry/opentelemetry-specification/pull/3678/files#diff-1c55a70901ca0a001050f25ba8881a9b841777e6d8eaab500faf20230765ff76R806 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have read the documentation and tried all sorts of ways but I have never succeeded in adding span links to an existing span. I always get
AttributeError: 'Context' object has no attribute 'trace_id'
I have tried many different objects to insert into trace.Link(obj): Span, SpanContext, Context. Nothing works. I am at my wit's end.
Anyone has any insights? Thanks.
My latest attempt
Simplified code to reproduce issue
Error
OpenTelemetry versions
When I use Pycharm's debugger to pause execution, I can see an attribute object of
consumer_runner_context
which has a trace_id deep down in its attributes tree, and I can access it thusly:and this works:
But this hardly seems the right way to do this.
What is the right way to do this?
Beta Was this translation helpful? Give feedback.
All reactions