mirror of
https://github.com/mostlygeek/llama-swap.git
synced 2026-06-09 06:46:34 +02:00
7e3e94a08a
Add a comprehensive performance monitoring system that collects CPU, memory, swap, load average, network IO, and GPU stats. Provides both a REST API for the UI and a Prometheus /metrics endpoint. Backend changes: - New internal/perf package with configurable interval-based stats collection - GPU monitoring via LACT (Unix socket) and nvidia-smi fallback on Linux - Ring buffer (internal/ring) for time-series stat storage - Prometheus /metrics endpoint with all system and GPU metrics - Moved LogMonitor to internal/logmon package - New PerformanceConfig for hot-reloadable monitoring settings - REST /api/performance endpoint replacing SSE streaming UI changes: - New Performance page with real-time charts for CPU, memory, GPU, and network - Reusable PerformanceChart component - LLAMA_SWAP_URL environment variable support - Improved capture dialog display Other: - Example Grafana dashboard for Prometheus metrics - monitor-test standalone binary - Config schema and example updates fixes #596
61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
package proxy
|
|
|
|
// package level registry of the different event types
|
|
|
|
const ProcessStateChangeEventID = 0x01
|
|
const ChatCompletionStatsEventID = 0x02
|
|
const ConfigFileChangedEventID = 0x03
|
|
const ActivityLogEventID = 0x05
|
|
const ModelPreloadedEventID = 0x06
|
|
const InFlightRequestsEventID = 0x07
|
|
|
|
type ProcessStateChangeEvent struct {
|
|
ProcessName string
|
|
NewState ProcessState
|
|
OldState ProcessState
|
|
}
|
|
|
|
func (e ProcessStateChangeEvent) Type() uint32 {
|
|
return ProcessStateChangeEventID
|
|
}
|
|
|
|
type ChatCompletionStats struct {
|
|
TokensGenerated int
|
|
}
|
|
|
|
func (e ChatCompletionStats) Type() uint32 {
|
|
return ChatCompletionStatsEventID
|
|
}
|
|
|
|
type ReloadingState int
|
|
|
|
const (
|
|
ReloadingStateStart ReloadingState = iota
|
|
ReloadingStateEnd
|
|
)
|
|
|
|
type ConfigFileChangedEvent struct {
|
|
ReloadingState ReloadingState
|
|
}
|
|
|
|
func (e ConfigFileChangedEvent) Type() uint32 {
|
|
return ConfigFileChangedEventID
|
|
}
|
|
|
|
type ModelPreloadedEvent struct {
|
|
ModelName string
|
|
Success bool
|
|
}
|
|
|
|
func (e ModelPreloadedEvent) Type() uint32 {
|
|
return ModelPreloadedEventID
|
|
}
|
|
|
|
type InFlightRequestsEvent struct {
|
|
Total int
|
|
}
|
|
|
|
func (e InFlightRequestsEvent) Type() uint32 {
|
|
return InFlightRequestsEventID
|
|
}
|