Skip to content

v1.17.0

Choose a tag to compare

@soltanoff soltanoff released this 11 Jul 17:24
a6ee41a

Distributed Tracing with OpenTelemetry

End-to-end distributed tracing across the entire request path, powered by OpenTelemetry. A single trace now spans all four transports and every architectural layer: controller -> usecase -> repo. It's exported over OTLP/gRPC to a collector (Jaeger in the docker stack).

What's new

  • OTLP/gRPC exporter - a global TracerProvider (pkg/tracing) with configurable endpoint, TLS, and sampling; spans batch-export to any OTLP-compatible backend.
  • Cross-transport context propagation - W3C traceparent + baggage, so traces stay connected regardless of transport:
    • REST -> otelfiber middleware
    • gRPC -> otelgrpc stats handler
    • AMQP RPC / NATS RPC -> trace context carried in message headers via custom carriers
  • Instrumented business layers -> use cases and repositories wrapped in tracing decorators, giving full visibility from handler down to DB and external web API calls.
  • Jaeger in the docker stack -> make compose-up-all now brings up Jaeger, reachable through the nginx reverse proxy.
  • No-op when disabled -> with TRACING_ENABLED=false, a no-op tracer provider is installed; instrumentation runs unconditionally with zero overhead.
  • Internal routes excluded -> /healthz, /metrics, /swagger are not traced; only versioned API groups are instrumented.

Configuration

Variable Default Description
TRACING_ENABLED false Enable OpenTelemetry tracing
TRACING_OTLP_ENDPOINT localhost:4317 OTLP/gRPC collector endpoint
TRACING_OTLP_INSECURE true Disable TLS for the OTLP exporter
TRACING_SAMPLE_RATE 0.1 Parent-based sampling ratio

⚠️ Sampling is parent-based - use 1.0 locally, but keep it low (0.1 / 0.01) in production.

Upgrade notes

  • Tracing is off by default - no action required to keep current behavior. To enable, set TRACING_ENABLED=true and point TRACING_OTLP_ENDPOINT at your collector.
  • Persistent repos were reorganized into per-domain packages to host the tracing decorators; the composition root was updated accordingly. No public API or transport contract changes.

PR's

Full Changelog: v1.16.4...v1.17.0