Skip to main content

Module observability

Module observability 

Source
Expand description

Observability — tracing layer stack + (feature-gated) OpenTelemetry OTLP exporter wiring.

Two entry points:

  • init — install the global subscriber. Call once at daemon startup before any other tracing event fires. Respects the following env vars:

    VarDefaultEffect
    RUST_LOGinfoEnvFilter directives
    OTEL_LOG_FORMATcompactcompact / pretty / json
    OTEL_SERVICE_NAMEpost-cortexOTel service.name attr
    OTEL_SERVICE_VERSIONcrate versionOTel service.version
    OTEL_EXPORTER_OTLP_ENDPOINTunsetWhen set + otel feature on, spans + metrics export to this gRPC endpoint
  • shutdown — call before process exit so the OTLP exporter flushes its queue.

When the otel feature is OFF, init still wires the fmt::Subscriber layer + EnvFilter — only the OTLP layer disappears. Library users that disable OTel pay nothing.

Enums§

TracingInitError
Errors raised by init.

Functions§

init
Initialise the global tracing subscriber.
shutdown
Flush pending spans + metrics, then shut down the OTel SDK.