telemetry

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp    string    `json:"timestamp"`
	ProviderID   string    `json:"provider_id,omitempty"`
	EventType    EventType `json:"event_type"`
	LatencyMS    int64     `json:"latency_ms,omitempty"`
	InputTokens  int       `json:"input_tokens,omitempty"`
	OutputTokens int       `json:"output_tokens,omitempty"`
	ToolName     string    `json:"tool_name,omitempty"`
	Success      *bool     `json:"success,omitempty"`
	Error        string    `json:"error,omitempty"`
}

Event is a single telemetry record written as one JSON line.

type EventType

type EventType string

EventType identifies the kind of telemetry event.

const (
	EventProviderResponse  EventType = "provider_response"
	EventConsensusComplete EventType = "consensus_complete"
	EventToolExecuted      EventType = "tool_executed"
	EventPipelineError     EventType = "pipeline_error"
	EventQueryStart        EventType = "query_start"
)

type Logger

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

Logger appends telemetry events to a JSONL file.

func NewLogger

func NewLogger() (*Logger, error)

NewLogger opens (or creates) the telemetry log file at <ConfigDir>/telemetry.jsonl. If the file exceeds 10 MB it is truncated to the last 5 MB before the logger begins appending.

func (*Logger) Close

func (l *Logger) Close() error

Close flushes and closes the underlying file.

func (*Logger) Log

func (l *Logger) Log(event Event)

Log records a single event. It sets the timestamp automatically and is safe for concurrent use.

Jump to

Keyboard shortcuts

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