cgroups

package
v15.5.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 13 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 CGroupV1Manager

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

CGroupV1Manager is the manager for cgroups v1

func (*CGroupV1Manager) AddCommand

func (cg *CGroupV1Manager) AddCommand(
	cmd *command.Command,
	repo repository.GitRepo,
) (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 Command to a cgroup.
	AddCommand(*command.Command, repository.GitRepo) (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(cmd *command.Command, repo repository.GitRepo) (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