Documentation
¶
Overview ¶
Package tracing wires OpenTelemetry distributed tracing for the LLM proxy.
ENABLE_TRACING and TRACING_ENDPOINT have been parsed into the gateway config for some time without anything behind them; this package is what they now drive. When tracing is disabled the global provider stays OpenTelemetry's no-op implementation, so span creation on the request path costs nothing and callers never need to branch on whether it is on.
Index ¶
Constants ¶
const TracerName = "aistudio/proxy"
TracerName is the instrumentation scope for every span this package's callers create.
Variables ¶
This section is empty.
Functions ¶
func ExtractIncoming ¶
ExtractIncoming returns a context carrying the trace parent from the inbound request headers, so gateway spans become children of the caller's trace rather than starting a disconnected one.
func InjectOutgoing ¶
InjectOutgoing writes the current trace context into the upstream request headers so the provider (or an in-cluster model server) can continue the trace.
func Use ¶
func Use(provider trace.TracerProvider, propagator propagation.TextMapPropagator)
Use makes Studio create spans from provider and carry trace context with propagator instead of the OpenTelemetry globals, which belong to an embedding host. A nil argument keeps the corresponding global.
Types ¶
type Config ¶
type Config struct {
Enabled bool
// Endpoint is the OTLP collector address. A bare "host:port" is assumed to
// be an insecure gRPC endpoint; an http:// or https:// URL sets the
// transport security from the scheme.
Endpoint string
ServiceName string
ServiceVersion string
}
Config describes how to export spans. It mirrors the existing ObservabilityConfig fields rather than introducing new ones.
type Shutdown ¶
Shutdown flushes and stops the exporter. It is always non-nil, so callers can defer it unconditionally.
func Init ¶
Init installs a global TracerProvider and the W3C trace context propagator.
The propagator is installed even when tracing is disabled: it costs nothing, and it means an incoming traceparent is still carried through to the upstream provider so a caller's own tracing stays connected across the gateway.