Documentation
¶
Overview ¶
Package metrics provides basic metrics collection (counters, timers, gauges).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a monotonically increasing counter.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a value that can go up and down.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages named metrics.
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer tracks timing information.
type TimerStats ¶
type TimerStats struct {
Count int64 `json:"count"`
Total time.Duration `json:"total"`
Mean time.Duration `json:"mean"`
Min time.Duration `json:"min"`
Max time.Duration `json:"max"`
}
TimerStats represents timer statistics.
type ToolAggregate ¶ added in v0.2.0
ToolAggregate holds per-tool aggregate statistics collected during a session.
type ToolAggregator ¶ added in v0.2.0
type ToolAggregator struct {
// contains filtered or unexported fields
}
ToolAggregator collects per-tool call statistics in a thread-safe manner. Inspired by herm's TraceToolSummary pattern for per-tool aggregates.
func NewToolAggregator ¶ added in v0.2.0
func NewToolAggregator() *ToolAggregator
NewToolAggregator creates a new ToolAggregator ready for use.
func (*ToolAggregator) All ¶ added in v0.2.0
func (a *ToolAggregator) All() map[string]*ToolAggregate
All returns a snapshot of all tool aggregates. The returned map is a copy.
func (*ToolAggregator) Get ¶ added in v0.2.0
func (a *ToolAggregator) Get(toolName string) *ToolAggregate
Get returns the aggregate for a specific tool, or nil if not recorded.
func (*ToolAggregator) Record ¶ added in v0.2.0
func (a *ToolAggregator) Record(toolName string, bytes int64, durationMs int64, isError bool)
Record records a tool invocation with its byte count, duration, and error status.
func (*ToolAggregator) Reset ¶ added in v0.2.0
func (a *ToolAggregator) Reset()
Reset clears all recorded tool aggregates.
type ToolExecution ¶ added in v0.2.0
type ToolExecution struct {
Name string
StartTime time.Time
Duration time.Duration
Success bool
Error string
}
ToolExecution records a single tool invocation.
type ToolMetrics ¶ added in v0.2.0
ToolMetrics holds per-tool metrics.
func (*ToolMetrics) AvgDuration ¶ added in v0.2.0
func (m *ToolMetrics) AvgDuration() time.Duration
AvgDuration returns average call duration for a tool.
func (*ToolMetrics) SuccessRate ¶ added in v0.2.0
func (m *ToolMetrics) SuccessRate() float64
SuccessRate returns the success rate for a tool.
type ToolMonitor ¶ added in v0.2.0
type ToolMonitor struct {
// contains filtered or unexported fields
}
ToolMonitor tracks real-time tool execution metrics.
func NewToolMonitor ¶ added in v0.2.0
func NewToolMonitor() *ToolMonitor
NewToolMonitor creates a new monitor.
func (*ToolMonitor) End ¶ added in v0.2.0
func (tm *ToolMonitor) End(name, callID string, success bool, errMsg string)
End records the completion of a tool call.
func (*ToolMonitor) Start ¶ added in v0.2.0
func (tm *ToolMonitor) Start(name, callID string)
Start records the beginning of a tool call.
func (*ToolMonitor) Stats ¶ added in v0.2.0
func (tm *ToolMonitor) Stats() ToolStats
Stats returns aggregated metrics.