Context
When using LangSmith for tracing and monitoring, you may notice that some traces show an "incomplete" status. This can prevent accurate calculation of full trace metrics, including latency for the entire graph, even when individual step metrics are available.
Answer
An "incomplete" status in LangSmith means that the "end" event for a trace was never successfully received by the LangSmith server. This occurs because LangSmith ingests traces in a background thread to avoid adding overhead to your application.
Common causes for incomplete traces include:
Process termination before all traces are uploaded
Runs not sending completion signals
End times not being recorded for all steps
Network issues preventing data from reaching LangSmith
To prevent incomplete traces, follow these steps:
Update to the latest version of the LangSmith SDK
Before your program exits, call the following function to ensure all traces are submitted:
wait_for_all_tracers()Ensure all runs finish cleanly and send their completion signals
Important notes:
There is no explicit timeout set by LangSmith for traces
LangSmith does not automatically retry incomplete traces
You may still see latency metrics for individual completed steps, but the full trace metrics won't be reliable until marked complete
Additional information available at: https://docs.smith.langchain.com/observability/how_to_guides/trace_with_langchain#ensure-all-traces-are-submitted-before-exiting