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

collector

package
v0.0.0-...-fafd151 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DCGM_CLOCKS_THROTTLE_REASON_GPU_IDLE Nothing is running on the GPU and the clocks are dropping to Idle state
	DCGM_CLOCKS_THROTTLE_REASON_GPU_IDLE clockEventBitmask = 0x0000000000000001
	// DCGM_CLOCKS_THROTTLE_REASON_CLOCKS_SETTING GPU clocks are limited by current setting of applications clocks
	DCGM_CLOCKS_THROTTLE_REASON_CLOCKS_SETTING clockEventBitmask = 0x0000000000000002
	// DCGM_CLOCKS_THROTTLE_REASON_SW_POWER_CAP SW Power Scaling algorithm is reducing the clocks below requested clocks
	DCGM_CLOCKS_THROTTLE_REASON_SW_POWER_CAP clockEventBitmask = 0x0000000000000004
	// DCGM_CLOCKS_THROTTLE_REASON_HW_SLOWDOWN HW Slowdown (reducing the core clocks by a factor of 2 or more) is engaged
	DCGM_CLOCKS_THROTTLE_REASON_HW_SLOWDOWN clockEventBitmask = 0x0000000000000008
	// DCGM_CLOCKS_THROTTLE_REASON_SYNC_BOOST Sync Boost
	DCGM_CLOCKS_THROTTLE_REASON_SYNC_BOOST clockEventBitmask = 0x0000000000000010
	// SW Thermal Slowdown
	DCGM_CLOCKS_THROTTLE_REASON_SW_THERMAL clockEventBitmask = 0x0000000000000020
	// DCGM_CLOCKS_THROTTLE_REASON_HW_THERMAL HW Thermal Slowdown (reducing the core clocks by a factor of 2 or more) is engaged
	DCGM_CLOCKS_THROTTLE_REASON_HW_THERMAL clockEventBitmask = 0x0000000000000040
	// DCGM_CLOCKS_THROTTLE_REASON_HW_POWER_BRAKE HW Power Brake Slowdown (reducing the core clocks by a factor of 2 or more) is engaged
	DCGM_CLOCKS_THROTTLE_REASON_HW_POWER_BRAKE clockEventBitmask = 0x0000000000000080
	// DCGM_CLOCKS_THROTTLE_REASON_DISPLAY_CLOCKS GPU clocks are limited by current setting of Display clocks
	DCGM_CLOCKS_THROTTLE_REASON_DISPLAY_CLOCKS clockEventBitmask = 0x0000000000000100
)

Source of the const values: https://github.com/NVIDIA/DCGM/blob/master/dcgmlib/dcgm_fields.h

View Source
const (
	FailedToConvert = "ERROR - FAILED TO CONVERT TO STRING"

	LinkStatusOK                   = "OK"
	LinkStatusChipsetNotSupported  = "ChipsetNotSupported"
	LinkStatusGPUNotSupported      = "GPUNotSupported"
	LinkStatusTopologyNotSupported = "TopologyNotSupported"
	LinkStatusDisabledByRegKey     = "DisabledByRegKey"
	LinkStatusNotSupported         = "NotSupported"
	LinkStatusUnknown              = "Unknown"

	PeerGPULabel    = "peer_gpu"
	LinkStatusLabel = "link_status"
)

Variables

This section is empty.

Functions

func IsDCGMExpClockEventsCountEnabled

func IsDCGMExpClockEventsCountEnabled(counterList counters.CounterList) bool

IsDCGMExpClockEventsCountEnabled checks if the DCGM_EXP_CLOCK_EVENTS_COUNT counter exists

func IsDCGMExpClockEventsTotalEnabled

func IsDCGMExpClockEventsTotalEnabled(counterList counters.CounterList) bool

IsDCGMExpClockEventsTotalEnabled checks if the DCGM_EXP_CLOCK_EVENTS_TOTAL counter exists.

func IsDCGMExpGPUHealthStatusEnabled

func IsDCGMExpGPUHealthStatusEnabled(counterList counters.CounterList) bool

func IsDCGMExpP2PStatusEnabled

func IsDCGMExpP2PStatusEnabled(counterList counters.CounterList) bool

IsDCGMExpP2PStatusEnabled checks if the DCGM_EXP_P2P_STATUS counter exists

func IsDCGMExpXIDErrorsCountEnabled

func IsDCGMExpXIDErrorsCountEnabled(counterList counters.CounterList) bool

func IsDCGMExpXIDErrorsTotalEnabled

func IsDCGMExpXIDErrorsTotalEnabled(counterList counters.CounterList) bool

IsDCGMExpXIDErrorsTotalEnabled checks if the DCGM_EXP_XID_ERRORS_TOTAL counter exists.

Types

type Collector

type Collector interface {
	GetMetrics() (MetricsByCounter, error)
	Cleanup()
}

Collector interface

func NewClockEventsCollector

func NewClockEventsCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

func NewClockEventsTotalCollector

func NewClockEventsTotalCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

func NewGPUHealthStatusCollector

func NewGPUHealthStatusCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

func NewP2PStatusCollector

func NewP2PStatusCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

NewP2PStatusCollector creates a new P2P status collector

func NewXIDCollector

func NewXIDCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

func NewXIDTotalCollector

func NewXIDTotalCollector(
	counterList counters.CounterList,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (Collector, error)

type DCGMCollector

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

DCGMCollector owns the watched DCGM fields for one entity type and converts their latest values into exporter metrics during each Prometheus collection.

func NewDCGMCollector

func NewDCGMCollector(
	c []counters.Counter,
	hostname string,
	config *appconfig.Config,
	deviceWatchList devicewatchlistmanager.WatchList,
) (*DCGMCollector, error)

func (*DCGMCollector) Cleanup

func (c *DCGMCollector) Cleanup()

Cleanup releases this collector's DCGM watch resources and is safe to call repeatedly.

func (*DCGMCollector) GetMetrics

func (c *DCGMCollector) GetMetrics() (MetricsByCounter, error)

GetMetrics collects one scrape and repairs a stale profiling watch once when needed.

type EntityCollectorTuple

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

func (*EntityCollectorTuple) Collector

func (e *EntityCollectorTuple) Collector() Collector

func (*EntityCollectorTuple) Entity

func (*EntityCollectorTuple) SetCollector

func (e *EntityCollectorTuple) SetCollector(collector Collector)

func (*EntityCollectorTuple) SetEntity

func (e *EntityCollectorTuple) SetEntity(entity dcgm.Field_Entity_Group)

type Factory

type Factory interface {
	// NewCollectors constructs collectors for each relevant entity type.
	//
	// Side effects: each returned collector installs DCGM field watches and
	// GPU groups. These are released by (*registry.Registry).Cleanup after
	// the collector is registered. Callers MUST register every returned
	// collector and MUST call this method exactly once per registry
	// lifecycle — calling it a second time without registering leaks DCGM
	// field groups and GPU groups, surfacing as "RemoveFieldWatch returned
	// -16 (NOT_WATCHED)" warnings in nv-hostengine.log.
	NewCollectors() []EntityCollectorTuple
}

func InitCollectorFactory

func InitCollectorFactory(
	counterSet *counters.CounterSet,
	deviceWatchListManager devicewatchlistmanager.Manager,
	hostname string,
	config *appconfig.Config,
) Factory

type Metric

type Metric struct {
	Counter       counters.Counter `json:"counter"`
	Value         string           `json:"value"`
	GPU           string           `json:"gpu,omitempty"`
	GPUUUID       string           `json:"gpu_uuid,omitempty"`
	GPUDevice     string           `json:"gpu_device,omitempty"`
	CPUSerial     string           `json:"cpu_serial,omitempty"`
	GPUModelName  string           `json:"gpu_model,omitempty"`
	GPUPCIBusID   string           `json:"pci_bus_id,omitempty"`
	UUID          string           `json:"uuid,omitempty"`
	MigProfile    string           `json:"mig_profile,omitempty"`
	NvSwitch      string           `json:"nv_switch,omitempty"`
	NvLink        string           `json:"nv_link,omitempty"`
	GPUInstanceID string           `json:"gpu_instance_id,omitempty"`
	// GPUComputeInstanceID becomes the GPU_CI_ID metric label for compute-instance metrics.
	GPUComputeInstanceID string                  `json:"gpu_compute_instance_id,omitempty"`
	Hostname             string                  `json:"hostname"`
	Labels               map[string]string       `json:"labels"`
	Attributes           map[string]string       `json:"attributes"`
	ParentType           dcgm.Field_Entity_Group `json:"parent_type"`
}

func (Metric) GetIDOfType

func (m Metric) GetIDOfType(idType appconfig.KubernetesGPUIDType) (string, error)

type MetricsByCounter

type MetricsByCounter map[counters.Counter][]Metric

MetricsByCounter represents a map where each Counter is associated with a slice of Metric objects

func (MetricsByCounter) GoString

func (m MetricsByCounter) GoString() string

GoString implements the GoStringer interface to return Go syntax representation

func (MetricsByCounter) MarshalJSON

func (m MetricsByCounter) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for MetricsByCounter

func (MetricsByCounter) String

func (m MetricsByCounter) String() string

String implements the Stringer interface to return JSON representation

func (MetricsByCounter) ToBase64

func (m MetricsByCounter) ToBase64() string

ToBase64 returns the JSON representation encoded as base64

func (*MetricsByCounter) UnmarshalJSON

func (m *MetricsByCounter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for MetricsByCounter

Jump to

Keyboard shortcuts

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