Understand how and when to manually send buffered tracing data to SGP.
tracing.flush_queue()
to force a synchronous export of all spans currently buffered in the SDK’s internal queue. This method will block the calling thread until all pending spans have been sent.
Span
object. When you call span.flush()
, that specific span will be sent. For Trace
objects, flushing (trace.flush()
) will send the root span.
span.flush()
and trace.flush()
are blocking operations. This means the calling thread will pause until the data is successfully sent to the SGP platform.For non-blocking behavior (recommended in performance-sensitive applications), pass blocking=False
:flush_queue()
at the very end of your program. When the SDK’s background worker is shut down (e.g., when your Python application exits normally), it will automatically attempt to flush any remaining tracing data in the queue before exiting.