Skip to main content

Module observability

Module observability 

Source
Expand description

Logging + traces + panic discipline (PRD §11).

All logs go to stderr (stdout is reserved for program data). Format is selected by RUST_LOG_FORMAT (json in prod, pretty otherwise); verbosity by RUST_LOG via EnvFilter.

When OTEL_EXPORTER_OTLP_ENDPOINT is set, the tracing subscriber also gains an OpenTelemetry layer that batches spans and ships them via OTLP gRPC to the configured collector. OTEL_SERVICE_NAME overrides the service name (defaults to the caller’s argument). Dev runs without that env var pay zero overhead — the layer is not constructed.

Spans propagate through the in-process tokio runtime via tracing-opentelemetry; cross-process propagation across the connectrpc boundary uses the W3C traceparent header — wire it through the dialer when running in production.

Structs§

ShutdownGuard
Handle returned from init — keep it alive for the process lifetime; drop flushes traces before exit. SdkTracerProvider::shutdown blocks until exporters drain.

Functions§

init
Initialise the global tracing subscriber + (optional) OTel layer.