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
otelfeature is disabled.
Structs§
- Telemetry
Guard - 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
TRACEPARENTstring. - init
- Initialize telemetry based on
OTEL_EXPORTER_OTLP_ENDPOINT.