Is your feature request related to a problem?
I believe the issue is that the baggage.set_baggage(key, value) does not read the current context that later gets called by get_all( ). instead it creates a new Context object with the baggage entry added and returns but the newer context is never made "current"
Describe the solution you'd like
i guess use attach( ) with each context to make it current and then use detach( ) when it is complete
from opentelemetry import baggage, context, trace
tracer = trace.get_tracer(name)
global_ctx = baggage.set_baggage("context", "global")
token_global = context.attach(global_ctx)
with tracer.start_as_current_span(name="root span") as root_span:
parent_ctx = baggage.set_baggage("context", "parent")
token_parent = context.attach(parent_ctx)
with tracer.start_as_current_span(name="child span") as child_span:
child_ctx = baggage.set_baggage("context", "child")
token_child = context.attach(child_ctx)
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Is your feature request related to a problem?
I believe the issue is that the baggage.set_baggage(key, value) does not read the current context that later gets called by get_all( ). instead it creates a new Context object with the baggage entry added and returns but the newer context is never made "current"
Describe the solution you'd like
i guess use attach( ) with each context to make it current and then use detach( ) when it is complete
from opentelemetry import baggage, context, trace
tracer = trace.get_tracer(name)
global_ctx = baggage.set_baggage("context", "global")
token_global = context.attach(global_ctx)
with tracer.start_as_current_span(name="root span") as root_span:
parent_ctx = baggage.set_baggage("context", "parent")
token_parent = context.attach(parent_ctx)
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.