Documentation
¶
Overview ¶
Package tracing wires the OpenTelemetry trace SDK with an OTLP/HTTP exporter pointed at Grafana Tempo.
Configuration is env-only — there's exactly one production deployment and one happy path, so a config struct would be ceremony:
RIVOLT_OTEL_ENABLED = "true" | "false" (default: false) RIVOLT_OTEL_ENDPOINT = host:port (e.g. tempo.observability:4318) RIVOLT_OTEL_INSECURE = "true" | "false" (default: true — in-cluster) RIVOLT_OTEL_SAMPLE_RATIO = float in [0,1] (default: 1.0 at low scale) RIVOLT_OTEL_SERVICE_NAME = string (default: "rivolt")
At 1000 vehicles we'll dial the sample ratio down; today every trace lands in Tempo, which makes the "is the wiring even right?" question trivially answerable in Grafana.
Init is a no-op (returns a no-op shutdown) when disabled, so the rest of the codebase can call otel.Tracer(...) unconditionally — spans created against the global no-op TracerProvider are free.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShutdownFunc ¶
ShutdownFunc flushes pending spans and tears down the exporter. Always non-nil; safe to call when tracing is disabled.
func Init ¶
func Init(ctx context.Context, version string) (ShutdownFunc, error)
Init reads RIVOLT_OTEL_* env vars and, if enabled, installs a global TracerProvider with an OTLP/HTTP exporter. Returns a shutdown closure the caller MUST defer-call before process exit so buffered spans aren't dropped.
Returns (noopShutdown, nil) when RIVOLT_OTEL_ENABLED is unset or false — the global provider stays the no-op default.