We use dapr, which sends requests against our api and each request contains a body including a traceid
attribute. We want to use this trace id to build "contigous traces", something like this (pseudo-code):
@app.post("/api/doit")
def post_doit(request: Request):
get_json = async_to_sync(request.json)
data = get_json()
trace_id = data['traceid']
# do something to let me add a span related to the parent trace id
with tracer.start_as_current_span("/api/doit"):
request.post("some-outgoing-call") # this operation should be captured as a child of the "trace id" trace
return {"status": "SUCCESS"}
I'm struggling to find documentation on how to do this in the opentelemetry documentation. In "old" opentracing there was some "extract" methods for creating spans based on existing data from http headers etc, but I can 't find anything similar in opemtelemetry tracing. Any pointers very much appreciated!