telemetry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package telemetry wires codebot's LLM observability. It builds an OTLP/HTTP trace exporter for the configured backend (e.g. Langfuse) and returns a litellm hook that emits one generation span per LLM call — each tagged with the current session id so the backend groups a run's calls — plus a BindSession to supply that id once the session exists and a shutdown func that flushes pending spans. 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 BindSession

type BindSession func(provider func() string)

BindSession registers the provider that yields the current session id, used to tag every generation span so the backend (e.g. Langfuse) can group a session's calls. The hook is built at boot, before the session exists, so the binding happens later; the provider is read live on each call, so a mid-run session switch is reflected without re-binding.

func Setup

Setup builds the trace pipeline for cfg and returns: a litellm hook to register on every model, a BindSession to wire the session-id provider once the session is built, and a shutdown func that flushes pending spans. When telemetry is disabled it returns (nil, no-op bind, no-op shutdown, nil); callers register the hook only when it is non-nil.

Jump to

Keyboard shortcuts

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