observability

package
v0.9.48 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DirName      = "observability"
	DatabaseFile = "observability.db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestFilter

type RequestFilter struct {
	From     *time.Time
	To       *time.Time
	Status   string
	Model    string
	Source   string
	APIKeyID string
	Query    string
	Limit    int
	Offset   int
}

type RequestPage

type RequestPage struct {
	Items   []RequestRecord
	Total   int64
	Summary RequestSummary
}

type RequestRecord

type RequestRecord struct {
	ID                    string
	TraceID               string
	ThreadID              string
	StartedAt             time.Time
	CompletedAt           time.Time
	Method                string
	Path                  string
	Protocol              string
	Status                string
	StatusCode            int
	Stream                bool
	Model                 string
	Source                string
	SourceType            string
	SourceName            string
	APIKeyID              string
	APIKeyName            string
	PoolID                string
	PoolName              string
	PoolModel             string
	MemberModel           string
	FallbackCount         int64
	LimitedCount          int64
	InputTokens           int64
	OutputTokens          int64
	CacheReadInputTokens  int64
	CacheCreationTokens   int64
	CacheEligibleTokens   int64
	DurationMS            int64
	FirstTokenLatencyMS   int64
	ErrorMessage          string
	RequestBody           string
	ResponseBody          string
	RequestBodyTruncated  bool
	ResponseBodyTruncated bool
}

type RequestSummary

type RequestSummary struct {
	Requests       int64
	Succeeded      int64
	Failed         int64
	TotalTokens    int64
	AverageLatency float64
}

type Store

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

func Open

func Open(storageRoot string) (*Store, error)

func (*Store) Add

func (s *Store) Add(ctx context.Context, record RequestRecord) error

func (*Store) Cleanup

func (s *Store) Cleanup(ctx context.Context, retentionDays int) (int64, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteAll

func (s *Store) DeleteAll(ctx context.Context) error

func (*Store) GetRequest

func (s *Store) GetRequest(ctx context.Context, id string) (RequestRecord, error)

func (*Store) GetTrace

func (s *Store) GetTrace(ctx context.Context, traceID string) (TraceRecord, []RequestRecord, error)

func (*Store) ListRequests

func (s *Store) ListRequests(ctx context.Context, filter RequestFilter) (RequestPage, error)

func (*Store) ListTraces

func (s *Store) ListTraces(ctx context.Context, filter RequestFilter) (TracePage, error)

func (*Store) Path

func (s *Store) Path() string

type TracePage

type TracePage struct {
	Items []TraceRecord
	Total int64
}

type TraceRecord

type TraceRecord struct {
	TraceID      string
	ThreadID     string
	StartedAt    time.Time
	CompletedAt  time.Time
	Status       string
	RequestCount int64
	Models       []string
	TotalTokens  int64
	DurationMS   int64
}

Jump to

Keyboard shortcuts

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