observability

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package observability records redacted routing and lifecycle metadata.

Index

Constants

View Source
const (
	DefaultRetention = 30 * 24 * time.Hour
	DefaultMaxEvents = 10_000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Store     *store.Store
	LaunchID  int64
	Enabled   bool
	Retention time.Duration
	MaxEvents int
	Logger    *slog.Logger
}

type LifecycleEvent

type LifecycleEvent = store.LifecycleEvent

type Recorder

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

func NewRecorder

func NewRecorder(ctx context.Context, config Config) *Recorder

func (*Recorder) BeginRoute

func (r *Recorder) BeginRoute(ctx context.Context, start RouteStart) *RouteSpan

func (*Recorder) RecordLifecycle

func (r *Recorder) RecordLifecycle(ctx context.Context, event LifecycleEvent)

func (*Recorder) Snapshot

func (r *Recorder) Snapshot() Snapshot

type RouteResolution

type RouteResolution struct {
	SessionID     int64
	RouteKind     string
	ModelAlias    string
	ProviderName  string
	ProviderModel string
	Protocol      string
}

type RouteResult

type RouteResult struct {
	Status     string
	HTTPStatus int
	ErrorClass string
	Usage      TokenUsage
}

type RouteSpan

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

func (*RouteSpan) Complete

func (s *RouteSpan) Complete(ctx context.Context, result RouteResult)

func (*RouteSpan) RequestID

func (s *RouteSpan) RequestID() string

func (*RouteSpan) Resolve

func (s *RouteSpan) Resolve(ctx context.Context, resolution RouteResolution)

type RouteStart

type RouteStart struct {
	SessionID      int64
	Operation      string
	RequestedModel string
	Streaming      bool
	Tools          bool
	Thinking       bool
}

type Snapshot

type Snapshot struct {
	Enabled       bool   `json:"enabled"`
	Healthy       bool   `json:"healthy"`
	WriteFailures uint64 `json:"write_failures"`
	PrunedEvents  int64  `json:"pruned_events"`
	LastError     string `json:"last_error,omitempty"`
	LastFailureAt string `json:"last_failure_at,omitempty"`
}

type TokenUsage

type TokenUsage = store.TokenUsage

Jump to

Keyboard shortcuts

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