Skip to main content

Module otel

Module otel 

Source
Expand description

OpenTelemetry tracing layer with zero overhead when disabled.

This module provides OpenTelemetry distributed tracing support that can be compiled into production builds but only activated at runtime when an endpoint is configured.

§Transport

Uses HTTP transport with a blocking reqwest client. This works without an async runtime context because:

  • The BatchSpanProcessor spawns its own dedicated background thread
  • The reqwest-blocking-client handles HTTP exports synchronously

This is important because Zebra’s tracing component initializes before the Tokio runtime starts.

Constants§

EXPORTED_SPANS 🔒
The spans exported as traces, as (crate, span name) pairs.

Functions§

exporting_layer 🔒
Returns a layer that exports the spans and events is_exported selects to tracer.
is_exported 🔒
Returns true if the OpenTelemetry layer should see this span or event.
layer
Creates an OpenTelemetry layer if an endpoint is configured.
sampler_description 🔒
Returns the sampler Zebra uses, as the OpenTelemetry SDK describes it.
sampler_env_problem 🔒
Returns why the standard sampler environment variables won’t sample as an operator probably intended, if they won’t.
sampler_for_percent 🔒
Returns the sampler for a percentage of traces, treating values above 100 as 100.

Type Aliases§

OtelError
Error type for OpenTelemetry layer initialization.