Skip to content

Context propagation using AWS S3 metadata #1715

Answered by srikanthccv
CeeBeeCee asked this question in Q&A
Discussion options

You must be logged in to vote

Are you looking for a way to extract the trace context from carrier and use is it in your code? Probably something like this helps.

...
from opentelemetry.trace.propagation.textmap import DictGetter
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
...

carrier = {'traceparent': '00-a9c3b99a95cc045e573e163c3ac80a77-d99d251a8caecd06-01'} # response['Metadata'] in your case?
ctx = TraceContextTextMapPropagator().extract(DictGetter(), carrier)
# with 1.0 getter/setter are optional and `extract` signature changed. It would be just 
# `.extract(carrier)` as default getter is `DictGetter()`
with tracer.start_as_current_span('child', ctx):
    ...

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@CeeBeeCee
Comment options

@CeeBeeCee
Comment options

@srikanthccv
Comment options

@brunoripa
Comment options

Answer selected by CeeBeeCee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants