Documentation
¶
Overview ¶
Package tracing wires the OpenTelemetry Go SDK for the assistant's binaries. It follows the codebase's established "nil/unset disables the feature" convention (see e.g. Deps.Memory, Deps.GapReports in internal/agent): with no OTLP endpoint configured, Setup installs a no-op tracer provider and does not attempt any network connection, so a service with tracing left "on" but no collector present behaves exactly as it did before tracing existed — no dial attempts, no export errors, no added startup latency.
When configured, spans flow to any OTLP-compatible collector (the Otel Collector, Tempo, Jaeger, etc.) over gRPC.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shutdown ¶
Shutdown drains and closes the tracer provider. Callers should invoke it (with a bounded context) during graceful shutdown so buffered spans are not dropped when the process exits. It is always non-nil and always safe to call, including in the no-op case.
func Setup ¶
Setup installs the global OpenTelemetry tracer provider for serviceName ("assistant" or "assistant-apiserver") and returns a Shutdown func the caller must invoke on process exit.
Configuration is entirely via the standard OTEL_EXPORTER_OTLP_ENDPOINT (or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) env var — there is no assistant-specific tracing config. When neither is set, Setup installs go.opentelemetry.io/otel/trace/noop's TracerProvider: every span created through it is a genuine no-op (no allocation of span state beyond the interface, no batching goroutine, no exporter, no dial). This is the default posture in dev and in any environment without a collector, and it is safe to leave on unconditionally.
The W3C tracecontext + baggage propagators are always installed as the global propagator, independent of whether export is enabled, so trace-context headers (traceparent/tracestate) still flow through otelhttp-instrumented hops even when this particular process is not itself exporting spans — a downstream hop may have a collector configured even if this one doesn't.