monitor

package
v0.0.0-...-58f0ab6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUMonitor

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

CPUMonitor handles CPU usage monitoring

func NewCPUMonitor

func NewCPUMonitor() *CPUMonitor

NewCPUMonitor creates a new CPU monitor

func (*CPUMonitor) GetUsage

func (m *CPUMonitor) GetUsage() (float64, error)

GetUsage returns the current CPU usage percentage

type DiskMonitor

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

DiskMonitor handles disk I/O monitoring

func NewDiskMonitor

func NewDiskMonitor(checkIntervalMs int) *DiskMonitor

NewDiskMonitor creates a new disk I/O monitor

func (*DiskMonitor) GetUsage

func (m *DiskMonitor) GetUsage() (float64, error)

GetUsage returns the current disk I/O in KB/s

type GPUMetric

type GPUMetric = common.GPUMetrics

DEPRECATED: Use common.GPUMetrics instead This is kept for backward compatibility during transition Old implementations can convert between types as needed

type InputMonitor

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

InputMonitor tracks user input activity

func NewInputMonitor

func NewInputMonitor() *InputMonitor

NewInputMonitor creates a new input activity monitor

func (*InputMonitor) GetIdleSeconds

func (m *InputMonitor) GetIdleSeconds() (int, error)

GetIdleSeconds returns the number of seconds since the last input activity

type MemoryMonitor

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

MemoryMonitor handles memory usage monitoring

func NewMemoryMonitor

func NewMemoryMonitor() *MemoryMonitor

NewMemoryMonitor creates a new memory monitor

func (*MemoryMonitor) GetUsage

func (m *MemoryMonitor) GetUsage() (float64, error)

GetUsage returns the current memory usage percentage

type NetworkMonitor

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

NetworkMonitor handles network usage monitoring

func NewNetworkMonitor

func NewNetworkMonitor(checkIntervalMs int) *NetworkMonitor

NewNetworkMonitor creates a new network monitor

func (*NetworkMonitor) GetUsage

func (m *NetworkMonitor) GetUsage() (float64, error)

GetUsage returns the current network I/O in KB/s

type SnoozeEvent

type SnoozeEvent struct {
	Timestamp    time.Time            `json:"timestamp"`
	InstanceID   string               `json:"instance_id"`
	InstanceType string               `json:"instance_type"`
	Region       string               `json:"region"`
	Reason       string               `json:"reason"`
	Metrics      common.SystemMetrics `json:"metrics"`
	Tags         map[string]string    `json:"tags,omitempty"`
	NaptimeMins  int                  `json:"naptime_mins"`
}

SnoozeEvent represents a stopping action

type SystemMetrics

type SystemMetrics struct {
	Timestamp     time.Time           `json:"timestamp"`
	CPUPercent    float64             `json:"cpu_percent"`
	MemoryPercent float64             `json:"memory_percent"`
	NetworkKBps   float64             `json:"network_kbps"`
	DiskIOKBps    float64             `json:"disk_io_kbps"`
	InputIdleSecs int                 `json:"input_idle_secs"`
	GPUMetrics    []common.GPUMetrics `json:"gpu_metrics,omitempty"`
	IdleStatus    bool                `json:"idle_status"` // true if system is idle
	IdleReason    string              `json:"idle_reason,omitempty"`
}

DEPRECATED: Use common.SystemMetrics instead This is kept for backward compatibility during transition SystemMetrics represents a complete set of system measurements

type SystemMonitor

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

SystemMonitor coordinates all monitoring activities

func NewSystemMonitor

func NewSystemMonitor(cpuThreshold, memoryThreshold, networkThreshold, diskThreshold, gpuThreshold float64,
	inputThreshold, napTimeMinutes, checkIntervalMs int, gpuMonitoringEnabled bool) *SystemMonitor

NewSystemMonitor creates a new system monitor

func (*SystemMonitor) CollectMetrics

func (m *SystemMonitor) CollectMetrics() (common.SystemMetrics, error)

CollectMetrics gathers all system metrics and evaluates idle status

func (*SystemMonitor) GetIdleSince

func (m *SystemMonitor) GetIdleSince() *time.Time

GetIdleSince returns the time when the system became idle

func (*SystemMonitor) GetLastMetrics

func (m *SystemMonitor) GetLastMetrics() common.SystemMetrics

GetLastMetrics returns the most recently collected metrics

func (*SystemMonitor) ResetIdleState

func (m *SystemMonitor) ResetIdleState()

ResetIdleState resets the idle state tracking

func (*SystemMonitor) SetGPUService

func (m *SystemMonitor) SetGPUService(service common.AcceleratorInterface)

SetGPUService sets the GPU monitoring service This is used to break circular dependencies

func (*SystemMonitor) ShouldSnooze

func (m *SystemMonitor) ShouldSnooze() (bool, string)

ShouldSnooze determines if the instance should be snoozed based on idle time

Jump to

Keyboard shortcuts

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