tracing

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type ShutdownFunc func(ctx context.Context) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL