watchers

package
v16.11.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CgroupCPUWatcher

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

CgroupCPUWatcher implements ResourceWatcher interface for watching CPU throttling of cgroup. Cgroup doesn't have an easy way to gauge how bad the CPU is percentage. Hence, this watcher compares the recorded total throttled time between two polls. If the throttled time exceeds 50% of the observation window, it returns a backoff event. The watcher uses `throttled_time` (CgroupV1) or `throttled_usec` (CgroupV2) stats from the cgroup manager.

func NewCgroupCPUWatcher

func NewCgroupCPUWatcher(manager cgroups.Manager, cpuThrottledThreshold float64) *CgroupCPUWatcher

NewCgroupCPUWatcher is the initializer of CgroupCPUWatcher

func (*CgroupCPUWatcher) Name

func (c *CgroupCPUWatcher) Name() string

Name returns the name of CgroupCPUWatcher

func (*CgroupCPUWatcher) Poll

Poll asserts the cgroup statistics and returns a backoff event accordingly. The condition when a backoff event is returned is described above.

type CgroupMemoryWatcher

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

CgroupMemoryWatcher implements ResourceWatcher interface. This watcher polls the statistics from the cgroup manager. It returns a backoff event in two conditions: * The current memory usage exceeds a soft threshold (90%). * The cgroup is under OOM.

func NewCgroupMemoryWatcher

func NewCgroupMemoryWatcher(manager cgroups.Manager, memoryThreshold float64) *CgroupMemoryWatcher

NewCgroupMemoryWatcher is the initializer of CgroupMemoryWatcher

func (*CgroupMemoryWatcher) Name

func (c *CgroupMemoryWatcher) Name() string

Name returns the name of CgroupMemoryWatcher

func (*CgroupMemoryWatcher) Poll

Poll asserts the cgroup statistics and returns a backoff event accordingly when it is triggered. These stats are fetched from cgroup manager.

Jump to

Keyboard shortcuts

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