Skip to main content

flush_telemetry

Function flush_telemetry 

Source
pub fn flush_telemetry(
    timeout_seconds: Option<f64>,
) -> Result<(), TelemetryError>
Expand description

Force-flush installed providers without tearing them down.

The drain half of shutdown_telemetry: every provider we installed is force-flushed under the bounded-shutdown deadline (PROVIDE_EXPORTER_LOGS_SHUTDOWN_TIMEOUT_SECONDS) and stays installed and usable. Use it where records must be out before control returns — a request boundary, a checkpoint, a serverless freeze — rather than shutting telemetry down and paying to set it up again.

Returns Ok(()) when every signal drained within the deadline (including when nothing is installed) and Err when any was abandoned, so a caller flushing to be sure its records are out learns when they are not.

timeout_seconds overrides the configured deadline for this call; None uses the configured one. Matches Python’s flush_telemetry(timeout_seconds), TypeScript’s flushTelemetry(timeoutMs) and Go’s context deadline.