Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Telemetry initialization.

Controlled by OTEL_EXPORTER_OTLP_ENDPOINT (the standard OTLP env var):

  • unset → no-op (tracing disabled, zero overhead)
  • "stderr" → JSON spans/events to stderr (non-standard extension)
  • "http://..." → OTLP HTTP export (traces + logs) to the given endpoint

§Distributed tracing

If TRACEPARENT is set (W3C Trace Context format), spans are created as children of the remote parent. Use current_traceparent to extract the current span context for propagation to child processes.

Modules§

metrics
Lightweight metrics API. No-ops when the otel feature is disabled.

Structs§

TelemetryGuard
Opaque guard — dropping it flushes and shuts down the OTLP pipeline. Hold this in main() until exit.

Functions§

current_traceparent
Extract the current span’s trace context as a W3C TRACEPARENT string.
init
Initialize telemetry based on OTEL_EXPORTER_OTLP_ENDPOINT.