Documentation ¶
Overview ¶
Package oomwatch provides a way to detect near OOM conditions.
Index ¶
Constants ¶
View Source
const ( // MemoryLimitFile is the cgroup v1 memory.limit_in_bytes filepath relative // to DefaultCgroupPath. MemoryLimitFile = "memory/memory.limit_in_bytes" // MemoryUsageFile is the cgroup v1 memory.usage_in_bytes filepath relative // to DefaultCgroupPath. MemoryUsageFile = "memory/memory.usage_in_bytes" // MemoryMaxFile is the cgroup v2 memory.max filepath relative to // DefaultCgroupPath. MemoryMaxFile = "memory.max" // MemoryCurrentFile is the cgroup v2 memory.current filepath relative to // DefaultCgroupPath. MemoryCurrentFile = "memory.current" )
Variables ¶
View Source
var ( // DefaultCgroupPath is the default path to the cgroup directory within a // container. It is used to discover the cgroup files if they are not // provided. DefaultCgroupPath = "/sys/fs/cgroup/" )
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher can be used to detect near OOM conditions.
func New ¶
func New(memoryMaxPath, memoryCurrentPath string, memoryUsagePercentThreshold uint8, interval time.Duration, logger logr.Logger) (_ *Watcher, err error)
New returns a new Watcher with the given configuration. If the provided paths are empty, it will attempt to discover the paths to the cgroup files. It returns an error if the paths cannot be discovered or if the provided configuration is invalid.
Click to show internal directories.
Click to hide internal directories.