Help us shape the future of Go! Take the 2026 Go Developer Survey

nvidia

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

This file implements the NVML collectors (cgo; requires a dynamically linked binary). Per device:

  • hw.gpu.utilization and nvidia.gpu.memory_copy.utilization (sampled, with a current-state fallback)
  • hw.gpu.memory.usage, hw.gpu.memory.limit, hw.gpu.memory.utilization
  • hw.power and nvidia.gpu.power.limit
  • hw.temperature
  • nvidia.gpu.clock.speed per clock domain
  • nvidia.gpu.pcie.throughput per direction

and per process, on the process's own resource:

  • nvidia.gpu.process.utilization
  • nvidia.gpu.process.memory_copy.utilization

It is kept apart from package gpumetrics so that only parca-agent built with the gpumetrics tag links go-nvml: binaries that do must bind lazily (see build-gpu in the Makefile), which plain `go test` binaries don't.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector collects NVIDIA GPU metrics via NVML into a gpumetrics.Producer.

func NewCollector

func NewCollector() (*Collector, error)

NewCollector initializes NVML and enumerates the available NVIDIA devices. It returns an error if NVML is unavailable (e.g. no driver / no GPU), which the caller should treat as "GPU metrics disabled on this node" rather than fatal.

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context, rec *gpumetrics.Producer) error

Collect runs the background collection loops, recording into rec, until ctx is cancelled. A failing collector is logged and retried on its next tick rather than stopping collection.

func (*Collector) DeviceCount

func (c *Collector) DeviceCount() int

DeviceCount reports how many NVIDIA devices were enumerated.

Jump to

Keyboard shortcuts

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