exporter

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPrefix           = "nvidia_smi"
	DefaultNvidiaSmiCommand = "nvidia-smi"
)
View Source
const (
	DefaultQField = qFieldsAuto
)

Variables

This section is empty.

Functions

func BuildFQNameAndMultiplier added in v1.1.0

func BuildFQNameAndMultiplier(prefix string, rField RField, logger *slog.Logger) (string, float64)

func BuildQFieldToMetricInfoMap added in v1.1.0

func BuildQFieldToMetricInfoMap(
	prefix string,
	qFieldtoRFieldMap map[QField]RField,
	logger *slog.Logger,
) map[QField]MetricInfo

func QFieldSliceToStringSlice added in v0.1.7

func QFieldSliceToStringSlice(qs []QField) []string

func TransformRawValue added in v1.1.0

func TransformRawValue(rawValue string, valueMultiplier float64) (float64, error)

TransformRawValue transforms a raw value into a float64.

Types

type Cell added in v1.1.0

type Cell struct {
	QField   QField
	RField   RField
	RawValue string
}

type GPUExporter added in v0.5.0

type GPUExporter struct {
	Command runCmd
	// contains filtered or unexported fields
}

GPUExporter collects stats and exports them using the prometheus metrics package.

func New

func New(ctx context.Context, prefix string, nvidiaSmiCommand string, qFieldsRaw string,
	logger *slog.Logger,
) (*GPUExporter, error)

func (*GPUExporter) Collect added in v0.5.0

func (e *GPUExporter) Collect(metricCh chan<- prometheus.Metric)

Collect fetches the stats and delivers them as Prometheus metrics. It implements prometheus.Collector.

func (*GPUExporter) Describe added in v0.5.0

func (e *GPUExporter) Describe(descCh chan<- *prometheus.Desc)

Describe describes all the metrics ever exported by the exporter. It implements prometheus.Collector.

type MetricInfo

type MetricInfo struct {
	MType           prometheus.ValueType
	ValueMultiplier float64
	// contains filtered or unexported fields
}

func BuildMetricInfo added in v1.1.0

func BuildMetricInfo(prefix string, rField RField, logger *slog.Logger) MetricInfo

type QField added in v1.1.0

type QField string

QField stands for query field - the field name before the query.

func ExtractQFields added in v1.1.0

func ExtractQFields(text string) []QField

func ParseAutoQFields added in v0.1.7

func ParseAutoQFields(nvidiaSmiCommand string, command runCmd) ([]QField, error)

type RField added in v1.1.0

type RField string

RField stands for returned field - the field name as returned by the nvidia-smi.

type Row added in v1.1.0

type Row struct {
	QFieldToCells map[QField]Cell
	Cells         []Cell
}

type Table added in v1.1.0

type Table struct {
	Rows          []Row
	RFields       []RField
	QFieldToCells map[QField][]Cell
}

func ParseCSVIntoTable added in v1.1.0

func ParseCSVIntoTable(queryResult string, qFields []QField) (Table, error)

Jump to

Keyboard shortcuts

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