cgroups

package
v16.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PruneOldCgroups

func PruneOldCgroups(cfg cgroups.Config, logger log.FieldLogger)

PruneOldCgroups prunes old cgroups for both the memory and cpu subsystems

Types

type AddCommandOption

type AddCommandOption func(*addCommandCfg)

AddCommandOption is an option that can be passed to AddCommand.

func WithCgroupKey

func WithCgroupKey(cgroupKey string) AddCommandOption

WithCgroupKey overrides the key used to derive the Cgroup bucket. If not passed, then the command arguments will be used as the cgroup key.

type CGroupManager added in v16.2.0

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

CGroupManager is a manager class that implements specific methods related to cgroups

func (*CGroupManager) AddCommand added in v16.2.0

func (cgm *CGroupManager) AddCommand(cmd *exec.Cmd, opts ...AddCommandOption) (string, error)

AddCommand adds a Cmd to a cgroup

func (*CGroupManager) Cleanup added in v16.2.0

func (cgm *CGroupManager) Cleanup() error

Cleanup cleans up cgroups created in Setup.

func (*CGroupManager) Collect added in v16.2.0

func (cgm *CGroupManager) Collect(ch chan<- prometheus.Metric)

Collect is used to collect the current values of all CGroupManager prometheus metrics

func (*CGroupManager) Describe added in v16.2.0

func (cgm *CGroupManager) Describe(ch chan<- *prometheus.Desc)

Describe is used to generate description information for each CGroupManager prometheus metric

func (*CGroupManager) Setup added in v16.2.0

func (cgm *CGroupManager) Setup() error

Setup parent cgroups and repository sub cgroups

type Manager

type Manager interface {
	// Setup creates cgroups and assigns configured limitations.
	// It is expected to be called once at Gitaly startup from any
	// instance of the Manager.
	Setup() error
	// AddCommand adds a Cmd to a cgroup.
	AddCommand(*exec.Cmd, ...AddCommandOption) (string, error)
	// Cleanup cleans up cgroups created in Setup.
	// It is expected to be called once at Gitaly shutdown from any
	// instance of the Manager.
	Cleanup() error
	Describe(ch chan<- *prometheus.Desc)
	Collect(ch chan<- prometheus.Metric)
}

Manager supplies an interface for interacting with cgroups

func NewManager

func NewManager(cfg cgroups.Config, pid int) Manager

NewManager returns the appropriate Cgroups manager

type NoopManager

type NoopManager struct{}

NoopManager is a cgroups manager that does nothing

func (*NoopManager) AddCommand

func (cg *NoopManager) AddCommand(*exec.Cmd, ...AddCommandOption) (string, error)

func (*NoopManager) Cleanup

func (cg *NoopManager) Cleanup() error

func (*NoopManager) Collect

func (cg *NoopManager) Collect(ch chan<- prometheus.Metric)

Collect does nothing

func (*NoopManager) Describe

func (cg *NoopManager) Describe(ch chan<- *prometheus.Desc)

Describe does nothing

func (*NoopManager) Setup

func (cg *NoopManager) Setup() error

Jump to

Keyboard shortcuts

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