observability

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package observability derives vendor-neutral traces and aggregate metrics from agent events. It owns no goroutines and does not export prompts or tool payloads; applications decide where and how to persist or export snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	RunsStarted   uint64
	RunsCompleted uint64
	Turns         uint64
	ToolCalls     uint64
	ToolFailures  uint64
	Usage         ai.Usage
}

Metrics aggregates completed and in-flight observations. Counts are useful for a metrics exporter; usage is the sum reported by turn/run events.

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

Recorder consumes events through its Observe method, suitable for passing to agent.WithOnEvent. It is safe for concurrent agent runs.

func NewRecorder

func NewRecorder() *Recorder

NewRecorder creates an empty recorder.

func (*Recorder) Metrics

func (r *Recorder) Metrics() Metrics

Metrics returns an aggregate snapshot.

func (*Recorder) Observe

func (r *Recorder) Observe(_ context.Context, event agent.Event)

Observe records one normalized agent event. It deliberately retains only lifecycle metadata, names, timestamps, stop reason, and usage.

func (*Recorder) Trace

func (r *Recorder) Trace(runID string) (RunTrace, bool)

Trace returns a copy of a run trace and false when it is unknown.

type RunTrace

type RunTrace struct {
	RunID       string
	ParentRunID string
	Agent       string
	StartedAt   time.Time
	EndedAt     time.Time
	Stop        agent.StopReason
	Turns       int
	Usage       ai.Usage
	Tools       []ToolSpan
}

RunTrace is an immutable observability view of one run.

type ToolSpan

type ToolSpan struct {
	Name      string
	StartedAt time.Time
	EndedAt   time.Time
	Failed    bool
}

ToolSpan records one observed tool execution without retaining arguments or result content.

Directories

Path Synopsis
Package otel adapts pips agent events to OpenTelemetry traces and metrics.
Package otel adapts pips agent events to OpenTelemetry traces and metrics.

Jump to

Keyboard shortcuts

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