telemetry

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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.

func (*Run) End added in v0.3.0

func (r *Run) End(err error)

End finishes the agent-run span and records err when present.

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

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

func (t *Tracer) BindSession(provider func() string)

BindSession registers the provider that yields the current session id.

func (*Tracer) StartRun added in v0.3.0

func (t *Tracer) StartRun(ctx context.Context, name string) (context.Context, *Run)

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.

Jump to

Keyboard shortcuts

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