cgroupmetrics

package
v1.0.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cgroupmetrics reports resource use for the cgroup that contains the Dagger engine process.

CPU usage and memory accounting include processes in descendant cgroups. The standard engine layout expects the engine cgroup to have no cgroup descendants. CPU usage values are cumulative since cgroup creation, and the total value reported by the kernel is the accounting source; user and system values are diagnostic components. Memory peak is the peak for the cgroup lifetime. Memory breakdown fields are diagnostic and can overlap. These metrics do not imply attribution to a Dagger client or organization. In the standard layout, /init and /buildkit are siblings: user execution cgroups are not included. A different layout (including an engine at the namespace root) can include user workloads. This package observes that boundary; it does not enforce it.

CPU quota enforcement counters report only this cgroup's own quota. They exclude throttling caused by ancestor cgroups. Zero does not mean that the engine was not throttled.

Index

Constants

View Source
const (
	InstrumentationScopeName = "dagger.io/engine.resources"

	CPUTimeName           = "dagger.engine.cpu.time"
	CPUThrottledTimeName  = "dagger.engine.cpu.throttled.time"
	CPUPeriodsName        = "dagger.engine.cpu.periods"
	MemoryCurrentName     = "dagger.engine.memory.current"
	MemoryPeakName        = "dagger.engine.memory.peak"
	MemorySwapCurrentName = "dagger.engine.memory.swap.current"
	MemorySwapPeakName    = "dagger.engine.memory.swap.peak"
	MemoryBreakdownName   = "dagger.engine.memory.breakdown"
	MemoryEventsName      = "dagger.engine.memory.events"
	CgroupDescendantsName = "dagger.engine.cgroup.descendants"
	ResourceAvailableName = "dagger.engine.resource_metrics.available"
)

Variables

This section is empty.

Functions

func Register

func Register(ctx context.Context, meter metric.Meter) (metric.Registration, error)

Register discovers the engine process cgroup and registers one callback that reads its cgroup v2 accounting files for each OpenTelemetry collection. Discovery and read failures are reported as availability=0 and retried at collection time. Only instrument or callback registration failures return an error. Keep the callback registered until the meter provider shuts down.

Types

This section is empty.

Jump to

Keyboard shortcuts

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