Documentation
¶
Index ¶
- type AgentMetric
- type MetricsCollector
- func (c *MetricsCollector) RecordTokenUsage(usage TokenUsage)
- func (c *MetricsCollector) RecordToolExecution(name, agentName string, duration time.Duration, success bool)
- func (c *MetricsCollector) Reset()
- func (c *MetricsCollector) SessionMetrics(sessionKey string) *SessionMetric
- func (c *MetricsCollector) Snapshot() SystemSnapshot
- func (c *MetricsCollector) TopSessions(limit int) []SessionMetric
- type SessionMetric
- type SystemSnapshot
- type TokenUsage
- type TokenUsageSummary
- type ToolMetric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentMetric ¶
AgentMetric aggregates metrics for a single agent.
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector performs thread-safe in-memory metrics aggregation.
func NewCollector ¶
func NewCollector() *MetricsCollector
NewCollector creates a new MetricsCollector.
func (*MetricsCollector) RecordTokenUsage ¶
func (c *MetricsCollector) RecordTokenUsage(usage TokenUsage)
RecordTokenUsage records a token usage event.
func (*MetricsCollector) RecordToolExecution ¶
func (c *MetricsCollector) RecordToolExecution(name, agentName string, duration time.Duration, success bool)
RecordToolExecution records a tool execution event.
func (*MetricsCollector) Reset ¶
func (c *MetricsCollector) Reset()
Reset clears all collected metrics.
func (*MetricsCollector) SessionMetrics ¶
func (c *MetricsCollector) SessionMetrics(sessionKey string) *SessionMetric
SessionMetrics returns metrics for a specific session, or nil if not found.
func (*MetricsCollector) Snapshot ¶
func (c *MetricsCollector) Snapshot() SystemSnapshot
Snapshot returns a point-in-time copy of all metrics.
func (*MetricsCollector) TopSessions ¶
func (c *MetricsCollector) TopSessions(limit int) []SessionMetric
TopSessions returns the top N sessions by total tokens.
type SessionMetric ¶
type SessionMetric struct {
SessionKey string
InputTokens int64
OutputTokens int64
TotalTokens int64
RequestCount int64
}
SessionMetric aggregates metrics for a single session.
type SystemSnapshot ¶
type SystemSnapshot struct {
StartedAt time.Time
Uptime time.Duration
TokenUsageTotal TokenUsageSummary
ToolExecutions int64
ToolBreakdown map[string]ToolMetric
AgentBreakdown map[string]AgentMetric
SessionBreakdown map[string]SessionMetric
}
SystemSnapshot is a point-in-time summary of system metrics.
type TokenUsage ¶
type TokenUsage struct {
Provider string
Model string
SessionKey string
AgentName string
InputTokens int64
OutputTokens int64
TotalTokens int64
CacheTokens int64
Timestamp time.Time
}
TokenUsage records a single token usage event.