Context manager for activating context? #2048
Unanswered
annettejanewilson
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Might revisit: #732 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm trying to make sense of the baggage and tracing APIs. I see that there is the
trace.use_span
context manager for taking the implicit context and replacing it with one with a new span. But I can't see anything similar for contexts in general or baggage in particular. I note that the opentelemetry specification says:As far as I can tell the Python library is half-way between, is that right? For spans I can use context implicitly, but if I want to use baggage I seem to need to deal with contexts explicitly. For example to set baggage I can call
baggage.set_baggage
and if I specify no context it will read the implicit context, but then I still need to explicitly attach the returned context, store a token and use it to detach the context later. Would it make sense for there to be something to do this for baggage in a convenient context manager? Or perhaps I have misunderstood something?Beta Was this translation helpful? Give feedback.
All reactions