Documentation
¶
Overview ¶
Package telemetry wires codebot's observability. It builds an OTLP/HTTP trace exporter for the configured backend (e.g. Langfuse), returns a litellm hook for generation spans, and exposes a small Tracer for agent-run/tool spans. Every span is tagged with the current session id so the backend can group a session's work. When disabled it is a no-op, so the rest of the app stays unaware of OpenTelemetry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Run ¶ added in v0.3.0
type Run struct {
// contains filtered or unexported fields
}
Run holds an open agent-run span. End must be called when the agent emits EventAgentEnd; Prompt/Continue return before the background run finishes.
type Tracer ¶ added in v0.3.0
type Tracer struct {
// contains filtered or unexported fields
}
Tracer creates codebot-level spans that share the same tracer provider as the litellm hook. It is nil when telemetry is disabled.
func Setup ¶
func Setup(ctx context.Context, cfg config.TelemetryConfig) (litellm.Hook, *Tracer, func(context.Context) error, error)
Setup builds the trace pipeline for cfg and returns a litellm hook, a codebot tracer, and a shutdown func that flushes pending spans. When telemetry is disabled it returns (nil, nil, noop, nil).
func (*Tracer) BindSession ¶ added in v0.3.0
BindSession registers the provider that yields the current session id.
func (*Tracer) StartRun ¶ added in v0.3.0
StartRun starts an agent-run span and returns the child context for Agent.Prompt/Continue.
func (*Tracer) ToolMiddleware ¶ added in v0.3.0
func (t *Tracer) ToolMiddleware() agentcore.ToolMiddleware
ToolMiddleware emits one child span per tool execution.