Skip to main content

Module trace_export

Module trace_export 

Source
Expand description

§Module: Distributed Tracing Export

§Responsibility

Extends the existing OpenTelemetry integration with a TraceExporter that exports request-level traces (with one child span per pipeline stage) to multiple backends:

BackendFeature flagEnvironment variable
Jaeger (OTLP/HTTP)(always available)OTEL_EXPORTER_OTLP_ENDPOINT or JAEGER_ENDPOINT
ZipkinzipkinZIPKIN_ENDPOINT (e.g. http://localhost:9411)
DataDogdatadogDD_AGENT_HOST + optional DD_AGENT_PORT

Each PipelineSpan represents one pipeline stage and is exported as a child span under a root span keyed to the request_id.

§Design

  • The exporter is backend-agnostic at the type level; the active backend is selected at runtime from environment variables.
  • All export paths are async and non-blocking.
  • Failures are soft: a warning is logged, but the pipeline is not affected.

§Relationship to existing OTel setup

The existing try_build_otel_layer in lib.rs wires per-stage tracing spans automatically via tracing_opentelemetry. This module provides an additional, explicit exporter path that works without the global subscriber for environments that prefer push-based trace export.

Structs§

PipelineSpan
A single pipeline stage span, ready for export.
RequestTrace
A complete request-level trace with all child stage spans.
TraceExporter
Exports RequestTrace objects to the configured observability backend.
TraceExporterConfig
Configuration for the TraceExporter.

Enums§

PipelineStage
The five pipeline stages, in order.
TraceBackend
Which backend to export traces to.
TraceExportError
Errors produced by the trace exporter.