pgmetrics

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pgmetrics provides Prometheus metrics for cgroup resource usage under the opensvc.slice hierarchy.

It exposes cgroup metrics (CPU, memory, etc.) for the cgroups of the process groups: the opensvc slice itself, the slice of each namespace, and the slice of each object, told apart by the scope label.

Index

Constants

This section is empty.

Variables

View Source
var (
	// CgroupRoot is the root path for opensvc cgroups. A var rather than
	// a const so the tests can point collect() at a tree they built.
	CgroupRoot = "/sys/fs/cgroup/opensvc.slice"

	// BlockRoot holds a directory per block device, named by its
	// major:minor, as io.stat names them. A var for the tests.
	BlockRoot = "/sys/dev/block"

	// HostCgroupRoot is the root of the cgroup hierarchy, which holds the
	// opensvc slice and the other top level slices. ProcRoot and
	// CPUOnlineFile are where the host totals are read. Vars for the
	// tests.
	HostCgroupRoot = "/sys/fs/cgroup"
	ProcRoot       = "/proc"
	CPUOnlineFile  = "/sys/devices/system/cpu/online"
)

Functions

func Handler

func Handler() http.Handler

Handler serves /metrics/pg: the series of the walk, and, for each path query parameter, the series of the subsets and the resources of that object.

Types

type Manager

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

Manager manages the collection and reporting of cgroup metrics

func New

func New() *Manager

New creates a new pgmetrics manager.

It takes no queue sizer any more: it subscribes to nothing, having no goroutine left to receive on. The cgroup tree is read by the scrapes that ask for it.

func (*Manager) Start

func (m *Manager) Start(parent context.Context) error

Start registers the collectors. There is no goroutine to start any more: the work happens on the scrapes that ask for it.

func (*Manager) Stop

func (m *Manager) Stop() error

Jump to

Keyboard shortcuts

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