oomwatch

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package oomwatch provides a way to detect near OOM conditions.

Index

Constants

View Source
const (
	// DefaultCgroupPath is the default path to the cgroup directory.
	DefaultCgroupPath = "/sys/fs/cgroup/"
	// MemoryMaxFile is the cgroup memory.max filename.
	MemoryMaxFile = "memory.max"
	// MemoryCurrentFile is the cgroup memory.current filename.
	MemoryCurrentFile = "memory.current"
)

Variables

This section is empty.

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, error)

New returns a new Watcher.

func NewDefault

func NewDefault(memoryUsagePercentThreshold uint8, interval time.Duration, logger logr.Logger) (*Watcher, error)

NewDefault returns a new Watcher with default path values.

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context) context.Context

Watch returns a context that is canceled when the system reaches the configured memory usage threshold. Calling Watch multiple times will return the same context.

Jump to

Keyboard shortcuts

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