Skip to main content

init_observability

Function init_observability 

Source
pub fn init_observability(service_name: &str) -> ObservabilityGuard
Expand description

Initializes structured logging with optional OpenTelemetry trace and metric export.

ยงEnvironment variables

  • RUST_LOG: log level filter (default: info)
  • KMP_LOG_FORMAT: json | pretty | compact (default)
  • OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint for metric export and, when enabled, trace export (e.g. http://localhost:4317)
  • OTEL_TRACES_EXPORTER: standard OTel traces exporter selector. When set to none, trace export is disabled even if OTLP metrics remain enabled. When unset, traces follow the OTLP endpoint configuration.