cgroups

package
v15.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PruneOldCgroups added in v15.4.0

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

PruneOldCgroups prunes old cgroups for both the memory and cpu subsystems

Types

type AddCommandOption added in v15.7.0

type AddCommandOption func(*addCommandCfg)

AddCommandOption is an option that can be passed to AddCommand.

func WithCgroupKey added in v15.7.0

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 CGroupV1Manager

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

CGroupV1Manager is the manager for cgroups v1

func (*CGroupV1Manager) AddCommand

func (cg *CGroupV1Manager) AddCommand(
	cmd *exec.Cmd,
	opts ...AddCommandOption,
) (string, error)

AddCommand adds the given command to one of the CGroup's buckets. The bucket used for the command is determined by hashing the repository storage and path. No error is returned if the command has already exited.

func (*CGroupV1Manager) Cleanup

func (cg *CGroupV1Manager) Cleanup() error

func (*CGroupV1Manager) Collect

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

Collect collects metrics from the cgroups controller

func (*CGroupV1Manager) Describe

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

Describe describes the cgroup metrics that Collect provides

func (*CGroupV1Manager) Setup

func (cg *CGroupV1Manager) Setup() error

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