Documentation ¶
Index ¶
- func PruneOldCgroups(cfg cgroups.Config, logger log.FieldLogger)
- type AddCommandOption
- type CGroupV1Manager
- func (cg *CGroupV1Manager) AddCommand(cmd *exec.Cmd, opts ...AddCommandOption) (string, error)
- func (cg *CGroupV1Manager) Cleanup() error
- func (cg *CGroupV1Manager) Collect(ch chan<- prometheus.Metric)
- func (cg *CGroupV1Manager) Describe(ch chan<- *prometheus.Desc)
- func (cg *CGroupV1Manager) Setup() error
- type Manager
- type NoopManager
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 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
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