Skip to main content

Module otel

Module otel 

Source
Expand description

OpenTelemetry integration for distributed tracing

This module provides OpenTelemetry support with OTLP export for distributed tracing. It implements W3C Trace Context propagation (traceparent/tracestate headers).

§Features

  • W3C Trace Context header propagation
  • OTLP export to Jaeger, Tempo, or any OTLP-compatible backend
  • Configurable sampling rates
  • Request lifecycle spans with semantic conventions

§Configuration

observability {
    tracing {
        backend "otlp" {
            endpoint "http://localhost:4317"
        }
        sampling-rate 0.1  // 10% of requests
        service-name "grapsus"
    }
}

Structs§

OtelTracer
RequestSpan
TraceContext
Parsed W3C Trace Context

Enums§

OtelError
OpenTelemetry error types

Constants§

TRACEPARENT_HEADER
W3C Trace Context header names
TRACESTATE_HEADER

Functions§

create_traceparent
Create a traceparent header value
generate_span_id
Generate a new span ID (16 hex chars)
generate_trace_id
Generate a new trace ID (32 hex chars)
get_tracer
Get the global tracer
init_tracer
Initialize the global tracer
shutdown_tracer
Shutdown the global tracer