Pass Trace ID to Metric Attributes in Span Creation
Quick question I have a set up where we create a top level span for any new request coming into our app Once a request is complete only the top level span is seen in traces page with all other spans of that request underneath it The link to this top level span is such http://localhost:6006/projects/<project>/traces/<trace_id> We also have a metric that we update every time this new request comes in (or a new top level span is created) I wanna pass this trace_id for this top level span into the attributes of my metric what i need help with is how do i get something like this
def trace_work()
with tracer.start_as_current_span(
'some_name'
) as outer_span:
# Some work
outer_span_trace_id = ???
# emit metric
outer_span.set_status(trace_api.Status(trace_api.StatusCode.OK))
return