monitor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(mux *http.ServeMux, c *Collector)

RegisterRoutes registers the admin monitoring REST endpoints on the given mux.

Types

type AgentMetric

type AgentMetric struct {
	AgentID      string        `json:"agent_id"`
	Type         string        `json:"type"` // "llm" or "strategy"
	Strategy     string        `json:"strategy,omitempty"`
	Status       string        `json:"status"`
	ActionsTotal int64         `json:"actions_total"`
	ErrorsTotal  int64         `json:"errors_total"`
	LastAction   time.Time     `json:"last_action,omitzero"`
	LLMLatency   time.Duration `json:"llm_latency_ms,omitzero"`
	Team         string        `json:"team,omitempty"`
	System       string        `json:"system,omitempty"`
	Docked       bool          `json:"docked"`
}

AgentMetric holds per-agent runtime metrics.

type Collector

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

Collector gathers server and agent metrics.

func NewCollector

func NewCollector() *Collector

NewCollector creates a new metrics collector.

func (*Collector) AgentMetrics

func (c *Collector) AgentMetrics() []AgentMetric

AgentMetrics returns per-agent metrics from the configured provider.

func (*Collector) KnowledgeStats

func (c *Collector) KnowledgeStats() *KBStats

KnowledgeStats returns knowledge base statistics from the configured provider.

func (*Collector) LLMHealth

func (c *Collector) LLMHealth() *LLMMetrics

LLMHealth returns LLM provider metrics from the configured provider.

func (*Collector) ServerHealth

func (c *Collector) ServerHealth() ServerMetrics

ServerHealth returns current server health metrics.

func (*Collector) SetAgentCountFunc

func (c *Collector) SetAgentCountFunc(fn func() (llm, strategy int))

SetAgentCountFunc sets the function used to retrieve agent counts.

func (*Collector) SetAgentMetricsFunc

func (c *Collector) SetAgentMetricsFunc(fn func() []AgentMetric)

SetAgentMetricsFunc sets the function used to retrieve per-agent metrics.

func (*Collector) SetKBStatsFunc

func (c *Collector) SetKBStatsFunc(fn func() *KBStats)

SetKBStatsFunc sets the function used to retrieve knowledge base stats.

func (*Collector) SetLLMMetricsFunc

func (c *Collector) SetLLMMetricsFunc(fn func() *LLMMetrics)

SetLLMMetricsFunc sets the function used to retrieve LLM metrics.

type KBStats

type KBStats struct {
	Systems     int `json:"systems"`
	POIs        int `json:"pois"`
	Bases       int `json:"bases"`
	Experiences int `json:"experiences"`
	Items       int `json:"items"`
}

KBStats holds knowledge base statistics.

type LLMMetrics

type LLMMetrics struct {
	AvgLatency  time.Duration `json:"avg_latency_ms"`
	P99Latency  time.Duration `json:"p99_latency_ms"`
	ErrorRate   float64       `json:"error_rate"`
	RequestsMin float64       `json:"requests_per_min"`
	TotalCalls  int64         `json:"total_calls"`
	TotalErrors int64         `json:"total_errors"`
}

LLMMetrics tracks LLM provider health.

type ServerMetrics

type ServerMetrics struct {
	Uptime         time.Duration `json:"uptime_seconds"`
	GoRoutines     int           `json:"goroutines"`
	HeapAllocMB    float64       `json:"heap_alloc_mb"`
	HeapSysMB      float64       `json:"heap_sys_mb"`
	NumGC          uint32        `json:"num_gc"`
	TotalAgents    int           `json:"total_agents"`
	LLMAgents      int           `json:"llm_agents"`
	StrategyAgents int           `json:"strategy_agents"`
}

ServerMetrics holds overall server health metrics.

Jump to

Keyboard shortcuts

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