exporter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrUnexpectedQueryField = errors.New("unexpected query field")
	ErrParseNumber          = errors.New("could not parse number from value")
)
View Source
var ErrFieldCountMismatch = fmt.Errorf("field count mismatch")
View Source
var (
	ErrNoQueryFields = errors.New("could not extract any query fields")
)

Functions

func BuildFQNameAndMultiplier added in v1.1.0

func BuildFQNameAndMultiplier(prefix string, rField RField) (string, float64)

func BuildQFieldToMetricInfoMap added in v1.1.0

func BuildQFieldToMetricInfoMap(prefix string, qFieldtoRFieldMap map[QField]RField) 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)

Types

type Cell added in v1.1.0

type Cell[T any] struct {
	QField   QField
	RField   RField
	RawValue T
}

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(prefix string, nvidiaSmiCommand string, qFieldsRaw string, logger log.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(ch 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) 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[T any] struct {
	QFieldToCells map[QField]Cell[T]
	Cells         []Cell[T]
}

type Table added in v1.1.0

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

func ParseCSVIntoTable added in v1.1.0

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

Jump to

Keyboard shortcuts

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