pub struct TelemetryRuntime { /* private fields */ }Implementations§
Source§impl TelemetryRuntime
impl TelemetryRuntime
pub fn new() -> Self
Sourcepub fn start(
&mut self,
config: Option<TelemetryConfig>,
) -> Result<TelemetryConfig, TelemetryError>
pub fn start( &mut self, config: Option<TelemetryConfig>, ) -> Result<TelemetryConfig, TelemetryError>
Start the runtime, optionally with an explicit config.
None reads the environment. Mirrors Python’s start(config),
TypeScript’s start(config?) and Go’s Start(ctx, opts...).
Sourcepub fn shutdown(
&mut self,
timeout_seconds: Option<f64>,
) -> Result<(), TelemetryError>
pub fn shutdown( &mut self, timeout_seconds: Option<f64>, ) -> Result<(), TelemetryError>
Shut down, bounding the pre-teardown drain by timeout_seconds.
Sourcepub fn flush(
&self,
timeout_seconds: Option<f64>,
) -> Result<FlushResult, TelemetryError>
pub fn flush( &self, timeout_seconds: Option<f64>, ) -> Result<FlushResult, TelemetryError>
Flush installed providers, bounding the drain by timeout_seconds.
Each signal reports its own outcome. A signal with no provider is
not_installed; one whose provider was adopted from the OTel globals is
not_owned (the host’s to drain, so we leave it alone); the rest carry
the result of their own drain, not an aggregate of all three.
Returns Err when any owned signal’s records may still be queued —
abandoned at the deadline, or rejected by its exporter inside it — so
rt.flush(None)? before a freeze fails loudly instead of freezing with
records still queued — the contract setup::flush_telemetry has always
had. The two error messages stay distinct: an exporter that rejected
the drain in milliseconds never exceeded any deadline. Inspect the
FlushResult on Ok for per-signal detail.