-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Description
It is easy to create a trace with nested spans (Test 1). I want to use manual context propagation to achieve the same effect (Test 2).
with logfire.span("Test 1 - Nested spans"):
with logfire.span("Sleep 1 second"):
time.sleep(1)
with logfire.span("Sleep 2 seconds"):
time.sleep(2)
with logfire.span("Test 2 - Manual context propagation"):
context = logfire.get_context()
with logfire.attach_context(context):
with logfire.span("Sleep 1 second"):
time.sleep(1)
with logfire.attach_context(context):
with logfire.span("Sleep 2 seconds"):
time.sleep(2)
The issue is that the trace created with manual context propagation shows the total time when the trace is collapsed but a shorter time (probably just for get_context()) when the trace is expanded. Is there some way to get the expanded trace to show the total time?
For context: the use case is a Gradio app where the event chain should be logged in a single trace. The nested span approach isn't an option because there's no outer function to instrument.
Metadata
Metadata
Assignees
Labels
No labels