Documentation
¶
Overview ¶
Package trace records optional, privacy-preserving tool-call summaries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorKind ¶
type ErrorKind string
ErrorKind is a bounded failure category. It never contains a raw error.
const ( // ErrorNone indicates that an operation completed without an error. ErrorNone ErrorKind = "" // ErrorInvalidInput indicates invalid caller input. ErrorInvalidInput ErrorKind = "invalid_input" // ErrorCancelled indicates caller cancellation. ErrorCancelled ErrorKind = "cancelled" // ErrorDeadline indicates an operation deadline. ErrorDeadline ErrorKind = "deadline" // ErrorSubprocess indicates a subprocess failure. ErrorSubprocess ErrorKind = "subprocess" // ErrorAnalysis indicates an analyzer failure. ErrorAnalysis ErrorKind = "analysis" // ErrorInternal indicates an unexpected internal failure. ErrorInternal ErrorKind = "internal" )
type Event ¶
type Event struct {
Tool string
Args any
Duration time.Duration
PackagesLoad time.Duration
Analysis time.Duration
FindingsBySeverity map[string]int
AnalyzerDurations map[string]time.Duration
ResultSummary string
ErrorKind ErrorKind
}
Event is the caller-facing trace interface. Args are hashed and never stored.
type Record ¶
type Record struct {
Timestamp time.Time `json:"ts"`
Tool string `json:"tool"`
ArgsHash string `json:"args_hash"`
DurationMS int64 `json:"duration_ms"`
PackagesLoadMS int64 `json:"packages_load_ms"`
AnalysisMS int64 `json:"analysis_ms"`
FindingsBySeverity map[string]int `json:"findings_by_severity"`
AnalyzerDurationsMS map[string]int64 `json:"analyzer_durations_ms"`
ResultSummary string `json:"result_summary"`
Error bool `json:"error"`
ErrorKind ErrorKind `json:"error_kind"`
}
Record is the deliberately bounded on-disk representation.
type Summary ¶
type Summary struct {
Enabled bool `json:"enabled"`
RecordsConsidered int `json:"records_considered"`
Truncated bool `json:"truncated"`
Tools []ToolSummary `json:"tools"`
}
Summary describes a bounded recent window from the current server run.
type ToolSummary ¶
type ToolSummary struct {
Tool string `json:"tool"`
Calls int `json:"calls"`
ErrorCount int `json:"error_count"`
P50DurationMS int64 `json:"p50_duration_ms"`
P99DurationMS int64 `json:"p99_duration_ms"`
}
ToolSummary is a bounded aggregate for one tool in the current trace run.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer is safe for concurrent use. A zero Tracer is disabled.
func NewWithBaseDir ¶
NewWithBaseDir creates an enabled tracer beneath an explicit base directory. It exists so tests can exercise the same filesystem implementation locally.