Documentation
¶
Overview ¶
Package tracing wires OpenTelemetry tracing into a jargo voice agent.
The service processors emit spans through the global tracer, so instrumentation costs nothing until a TracerProvider is installed — without one, Tracer returns a no-op. Call Init at startup to export spans over OTLP, and wrap each session in StartConversation so the per-turn LLM and TTS spans nest under a single trace:
shutdown, err := tracing.Init(ctx, tracing.Config{ServiceName: "voicebot"})
defer shutdown(context.Background())
...
ctx, span := tracing.StartConversation(ctx, sessionID)
defer span.End()
task.Run(ctx) // LLM/TTS spans nest under the conversation span
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init installs a global TracerProvider that batches spans to an OTLP HTTP collector, and returns a shutdown function that flushes and stops it. Call the returned function on exit. The service processors begin emitting spans as soon as the provider is installed.
func StartConversation ¶
StartConversation begins the root span for one session. The returned context carries the span, so service spans created while processing the session's frames nest under it; pass it to pipeline.Task.Run. Call End on the returned span when the session ends.
Types ¶
type Config ¶
type Config struct {
// ServiceName labels the traces; defaults to "jargo".
ServiceName string
// ServiceVersion is an optional version label.
ServiceVersion string
// Endpoint overrides the OTLP HTTP endpoint (host:port). Empty honors the
// standard OTEL_EXPORTER_OTLP_ENDPOINT environment variable.
Endpoint string
// Insecure sends over plain HTTP instead of HTTPS.
Insecure bool
// SampleRatio is the head-sampling ratio in (0,1]. Zero (or less) always
// samples — jargo traces are low-volume, one trace per session.
SampleRatio float64
}
Config configures OTLP export.