Documentation
¶
Index ¶
- Constants
- Variables
- type Accessor
- type Alert
- type AlertManager
- type AppState
- func (s *AppState) ClearProcessMaps()
- func (s *AppState) GetFilteredProcesses() []ProcessInfo
- func (s *AppState) GetHistory(pid int32) (*RingBuffer, bool)
- func (s *AppState) GetOrCreateHistory(pid int32) *RingBuffer
- func (s *AppState) GetProcessByPid(pid int32) (ProcessInfo, bool)
- func (s *AppState) GetVisibleProcesses() ([]ProcessInfo, map[int32]int)
- func (s *AppState) InvalidateProcessCache()
- func (s *AppState) IsBookmarked(pid int32) bool
- func (s *AppState) IsCollapsed(pid int32) bool
- func (s *AppState) IsSuspended(pid int32) bool
- func (s *AppState) PruneDeadProcessHistory(alivePids map[int32]bool)
- func (s *AppState) PruneDeadProcessMaps(alivePids map[int32]bool)
- func (s *AppState) SetSuspended(pid int32, suspended bool)
- func (s *AppState) SyncProcessesMap()
- func (s *AppState) ToggleBookmark(pid int32)
- func (s *AppState) ToggleCollapsed(pid int32)
- type ConfigState
- type ConnectionInfo
- type ContainerInfo
- type DiskPartition
- type GpuInfo
- type HardwareCapabilities
- type K8sPodInfo
- type MetricsState
- type ProcessInfo
- type ProcessSnapshot
- type ProcessState
- type RemoteHostMetrics
- type RemoteProcessInfo
- type RemoteState
- type RingBuffer
- type ServiceInfo
- type SimpleViewport
- func (v *SimpleViewport) GotoBottom()
- func (v *SimpleViewport) GotoTop()
- func (v *SimpleViewport) HalfViewDown()
- func (v *SimpleViewport) HalfViewUp()
- func (v *SimpleViewport) LineDown(n int)
- func (v *SimpleViewport) LineUp(n int)
- func (v *SimpleViewport) SetContent(s string)
- func (v *SimpleViewport) SetHeight(h int)
- func (v *SimpleViewport) SetWidth(w int)
- func (v *SimpleViewport) View() string
- type Toast
- type UIState
- type VmInfo
Constants ¶
const ( ThresholdCount = 4 // CPU, Memory, Disk, Temp DisplayCount = 6 // ChartType, ViewType, SortBy, HistoryLen, ProcessCPU, SortDir TabCount = 9 // all available tabs AppearanceCount = 5 // Theme, RefreshRate, BorderType, BorderStyle, Background TotalSettingsCount = ThresholdCount + DisplayCount + TabCount + AppearanceCount )
Settings overlay index boundaries. Thresholds (0..ThresholdCount-1), Display (ThresholdCount..+DisplayCount), Tabs (+TabCount), Appearance (+AppearanceCount).
const ( MaxHealthScore = 100 // Thresholds for resource usage (Percentage) HealthThresholdHealthy = 90.0 // Below this is fine, above starts penalty HealthThresholdWarning = 70.0 // Warning level HealthThresholdCritical = 95.0 // Critical level // Penalties deducted from health score HealthDeductionCPUCritical = 30 HealthDeductionCPUHigh = 10 HealthDeductionMemoryCritical = 30 HealthDeductionMemoryHigh = 10 HealthDeductionDiskCritical = 20 HealthDeductionTempCritical = 30 HealthDeductionTempHigh = 10 // Process Tracking TopProcessesTrackCount = 5 // Kill Dialog KillDialogDefaultWidth = 50 KillDialogButtonTotalWidth = 16 KillDialogButtonYOffset = 4 // Settings Overlay SettingsDefaultWidth = 120 SettingsDefaultHeight = 22 // Context Menu ContextMenuDefaultWidth = 30 // Open Files Overlay OpenFilesDefaultWidth = 80 OpenFilesDefaultHeight = 20 SamLabDefaultWidth = 50 SamLabDefaultHeight = 14 )
Health Scoring Constants
const ( ToastInfo = "info" ToastError = "error" ToastWarn = "warn" ToastSuccess = "success" )
const ReservedContentRows = 19
Layout: reserved rows for header, footer, borders, and chrome. Used to calculate available content rows: UI.Height - ReservedContentRows.
Variables ¶
var AllAvailableTabs = []string{
"Metrics", "Processes", "Disks", "Network",
"System", "Services", "Connections", "Logs", "Remote",
}
AllAvailableTabs is the canonical list of every tab the settings UI can toggle/reorder.
Functions ¶
This section is empty.
Types ¶
type AlertManager ¶
type AlertManager struct {
ActiveAlerts map[config.MetricType]Alert
// contains filtered or unexported fields
}
func NewAlertManager ¶
func NewAlertManager() *AlertManager
func (*AlertManager) CheckAlerts ¶
func (am *AlertManager) CheckAlerts(s *AppState)
func (*AlertManager) GetAlerts ¶
func (am *AlertManager) GetAlerts() []Alert
func (*AlertManager) HasAlerts ¶
func (am *AlertManager) HasAlerts() bool
type AppState ¶
type AppState struct {
Metrics MetricsState
Process ProcessState
UI UIState
Config ConfigState
Remote RemoteState
LastErrorTime time.Time
// contains filtered or unexported fields
}
func (*AppState) ClearProcessMaps ¶
func (s *AppState) ClearProcessMaps()
func (*AppState) GetFilteredProcesses ¶
func (s *AppState) GetFilteredProcesses() []ProcessInfo
func (*AppState) GetHistory ¶
func (s *AppState) GetHistory(pid int32) (*RingBuffer, bool)
func (*AppState) GetOrCreateHistory ¶
func (s *AppState) GetOrCreateHistory(pid int32) *RingBuffer
func (*AppState) GetProcessByPid ¶ added in v0.5.0
func (s *AppState) GetProcessByPid(pid int32) (ProcessInfo, bool)
func (*AppState) GetVisibleProcesses ¶
func (s *AppState) GetVisibleProcesses() ([]ProcessInfo, map[int32]int)
func (*AppState) InvalidateProcessCache ¶
func (s *AppState) InvalidateProcessCache()
func (*AppState) IsBookmarked ¶
func (*AppState) IsCollapsed ¶
func (*AppState) IsSuspended ¶
func (*AppState) PruneDeadProcessHistory ¶
func (*AppState) PruneDeadProcessMaps ¶
func (*AppState) SetSuspended ¶
func (*AppState) SyncProcessesMap ¶ added in v0.5.0
func (s *AppState) SyncProcessesMap()
func (*AppState) ToggleBookmark ¶
func (*AppState) ToggleCollapsed ¶
type ConfigState ¶ added in v0.5.0
type ConfigState struct {
// Display configuration
Theme string
RefreshRate int
BorderType string
BorderStyle string
BackgroundOpaque bool
ProcessCpuNormalized bool
// Sorting
SortBy string
SortDirection string
// History
HistoryLength int
// Full config
Config config.AppConfig
// Timestamps
StartTime time.Time
LastConfigModTime time.Time
}
ConfigState holds all configuration-related state.
type ConnectionInfo ¶
type ContainerInfo ¶ added in v0.5.0
type ContainerInfo struct {
Name string
ID string
Status string
State string
Image string
Created string
CPUPercent float64
MemUsage uint64
MemLimit uint64
MemPct float64
NetRx uint64
NetTx uint64
Type string // "docker" or "kubernetes"
}
ContainerInfo represents container metrics
type DiskPartition ¶
type HardwareCapabilities ¶ added in v0.5.0
type K8sPodInfo ¶ added in v0.5.0
type K8sPodInfo struct {
Name string
Namespace string
Status string
Ready string
Restarts int
CPUReq string
MemReq string
CPULim string
MemLim string
CPUPercent float64
MemPct float64
Node string
Age string
}
K8sPodInfo represents Kubernetes pod metrics
type MetricsState ¶ added in v0.5.0
type MetricsState struct {
// History buffers
CpuHistory *RingBuffer
MemHistory *RingBuffer
NetHistory *RingBuffer
SwapHistory *RingBuffer
HistoryTemp *RingBuffer
// Current metrics
HostInfo *host.InfoStat
LoadAvg *load.AvgStat
MemInfo *mem.VirtualMemoryStat
SwapInfo *mem.SwapMemoryStat
CpuInfoStatic []cpu.InfoStat
Battery []*battery.Battery
// Disk I/O history and current
DiskHORead *RingBuffer
DiskHOWrite *RingBuffer
DiskIO map[string]disk.IOCountersStat
LastDiskIO map[string]disk.IOCountersStat
// Hardware detection flags
HasNvidiaGPU bool
HasAmdGPU bool
HasIntelGPU bool
HasBattery bool
HasNetworkInterfaces bool
HasDiskIO bool
HasServices bool
HasTempSensors bool
// Current values
Cpu float64
Memory float64
Disk float64
Swap float64
DiskReadRate float64
DiskWriteRate float64
CpuTemp float64
CpuPerCore []float64
// Disk and network info
DiskPartitions []DiskPartition
Sensors []host.TemperatureStat
NetworkInterfaces []net.IOCountersStat
LastNetworkInterfaces map[string]net.IOCountersStat
LastNetSent uint64
LastNetRecv uint64
NetSentRate float64
NetRecvRate float64
// GPU info
GpuInfo []GpuInfo
// Alerts
AlertManager *AlertManager
// Process history for graphs
ProcessHistory map[int32]*RingBuffer
// Health
HealthScore int
}
MetricsState holds all system metrics and history data.
type ProcessInfo ¶
type ProcessSnapshot ¶
type ProcessState ¶ added in v0.5.0
type ProcessState struct {
// Process lists
Processes []ProcessInfo
ProcessesByPid map[int32]ProcessInfo
CachedVisibleProcs []ProcessInfo
CachedTreeIndents map[int32]int
// Tree view state
TreeView bool
CollapsedPids map[int32]bool
BookmarkedPids map[int32]bool
// Filtering and sorting
ProcessFilter string
ProcessFilterLower string
SortBy string
SortDirection string
FilterMode bool
// Selection and scroll
SelectedProcess int
ProcessCount int
ProcessScrollOffset int
// Kill dialog
KillTargetName string
KillTargetPid int32
// Loading state
ProcessesLoaded bool
// Suspended processes
SuspendedState map[int32]bool
// Open files
OpenFilesView SimpleViewport
OpenFilesList []process.OpenFilesStat
ShowOpenFiles bool
OpenFilesPid int32
// Lazy-loaded data
ProcessCmdlines map[int32]string
ProcessUsernames map[int32]string
// Context menu
ShowProcessMenu bool
ProcessMenuIdx int
ProcessMenuX int
ProcessMenuY int
// Services and connections
Services []ServiceInfo
Connections []ConnectionInfo
ServicesScrollOffset int
ConnectionsScrollOffset int
SystemLogs []string
LogsScrollOffset int
// Dirty flag
ProcessCacheDirty bool
// Open files scroll
OpenFilesScrollOffset int
}
ProcessState holds all process management data.
type RemoteHostMetrics ¶ added in v0.5.0
type RemoteHostMetrics struct {
Uptime string
Cpu float64
CpuCount int
MemoryTotal uint64
MemoryUsed uint64
MemoryPct float64
SwapTotal uint64
SwapUsed uint64
SwapPct float64
DiskTotal uint64
DiskUsed uint64
DiskPct float64
NetSent uint64
NetRecv uint64
Processes []RemoteProcessInfo
LoadAvg1 float64
LoadAvg5 float64
LoadAvg15 float64
Error string
Online bool
}
type RemoteProcessInfo ¶ added in v0.5.0
type RemoteState ¶ added in v0.5.0
type RemoteState struct {
Metrics map[string]RemoteHostMetrics
}
RemoteState holds all remote monitoring state.
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
func NewRingBuffer ¶
func NewRingBuffer(size int) *RingBuffer
func (*RingBuffer) Avg ¶
func (r *RingBuffer) Avg() float64
func (*RingBuffer) Get ¶
func (r *RingBuffer) Get(i int) float64
func (*RingBuffer) Len ¶
func (r *RingBuffer) Len() int
func (*RingBuffer) Max ¶
func (r *RingBuffer) Max() float64
func (*RingBuffer) Push ¶
func (r *RingBuffer) Push(val float64)
func (*RingBuffer) Resize ¶ added in v0.6.0
func (r *RingBuffer) Resize(newSize int)
Resize creates a new buffer with the given size, preserving as much existing data as possible (newest data is kept).
type ServiceInfo ¶
type SimpleViewport ¶
type SimpleViewport struct {
// contains filtered or unexported fields
}
SimpleViewport wraps Bubbles viewport.Model to provide the same API
func NewSimpleViewport ¶
func NewSimpleViewport(width, height int) SimpleViewport
func (*SimpleViewport) GotoBottom ¶
func (v *SimpleViewport) GotoBottom()
func (*SimpleViewport) GotoTop ¶
func (v *SimpleViewport) GotoTop()
func (*SimpleViewport) HalfViewDown ¶
func (v *SimpleViewport) HalfViewDown()
func (*SimpleViewport) HalfViewUp ¶
func (v *SimpleViewport) HalfViewUp()
func (*SimpleViewport) LineDown ¶
func (v *SimpleViewport) LineDown(n int)
func (*SimpleViewport) LineUp ¶
func (v *SimpleViewport) LineUp(n int)
func (*SimpleViewport) SetContent ¶
func (v *SimpleViewport) SetContent(s string)
func (*SimpleViewport) SetHeight ¶ added in v0.5.0
func (v *SimpleViewport) SetHeight(h int)
func (*SimpleViewport) SetWidth ¶ added in v0.5.0
func (v *SimpleViewport) SetWidth(w int)
func (*SimpleViewport) View ¶
func (v *SimpleViewport) View() string
type UIState ¶ added in v0.5.0
type UIState struct {
// Window dimensions
Width int
Height int
// Tab state
SelectedTab int
ActiveTabs []string
HistoryLength int
// Interactive flags
Paused bool
ShowHelp bool
ShowSettings bool
ShowSamLab bool
// Settings dialog
SettingsEdit bool
SettingsSel config.MetricType
SettingsIdx int
// Kill dialog
ShowKillDialog bool
KillDialogSel int
// Toasts
Toasts []Toast
NextToastID int64
// Error handling
LastError string
LastErrorTime time.Time
TickCount uint64
// Chart display
ChartType string
// Scroll offsets for blocks
CpuCoreScrollOffset int
SystemBlockScrollOffsets map[int]int
ActiveScrollBlock int
SystemBlockCount int
SystemBlockScrollable map[int]bool
SystemBlockMaxScroll map[int]int
// Mouse position
MouseX int
MouseY int
// Input zones
Zones []input.Zone
ZoneManager interface{} // *input.ZoneManager - stored as interface to avoid circular import
// Content rendering
ContentBuilder strings.Builder
// Config timestamps
StartTime time.Time
LastConfigModTime time.Time
}
UIState holds all UI and display-related state.