Skip to main content

setup_tracing

Function setup_tracing 

Source
pub fn setup_tracing(otel: OpenTelemetry) -> Result<Option<OtelGuard>>
Expand description

Initializes tracing to stdout and optionally an open-telemetry exporter.

Stdout trace filtering is configured with MIDEN_STDOUT_FILTER, then RUST_LOG, then info,user=debug. OpenTelemetry export filtering is configured with MIDEN_OTEL_FILTER, then RUST_LOG, then info,axum::rejection=trace.

The open-telemetry configuration is controlled via environment variables as defined in the specification

Registers a panic hook so that panic errors are reported to the open-telemetry exporter.

Returns an OtelGuard if open-telemetry is enabled, otherwise None. When this guard is dropped, the tracer provider is shutdown.