metrics

package
v0.12.13 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MetricComponentLabelKey = "gpud_component"

MetricComponentLabelKey is the key for the component of the metric.

Variables

This section is empty.

Functions

func ConvertToLeptonMetrics

func ConvertToLeptonMetrics(ms Metrics) apiv1.GPUdComponentMetrics

func DefaultGatherer

func DefaultGatherer() prometheus.Gatherer

DefaultGatherer returns the default gatherer.

func DefaultRegisterer

func DefaultRegisterer() prometheus.Registerer

DefaultRegisterer returns the default registerer.

func MustRegister

func MustRegister(collectors ...prometheus.Collector)

func NormalizeComponentNameToMetricSubsystem

func NormalizeComponentNameToMetricSubsystem(componentName string) string

Types

type HealthStateSetter

type HealthStateSetter interface {
	Set(healthState apiv1.HealthStateType)
}

func RegisterHealthStateMetrics

func RegisterHealthStateMetrics(componentName string) (HealthStateSetter, error)

func RegisterHealthStateMetricsWithRegisterer

func RegisterHealthStateMetricsWithRegisterer(reg prometheus.Registerer, componentName string) (HealthStateSetter, error)

RegisterHealthStateMetricsWithRegisterer registers the health state metrics for the given component. Returns the function to update the health state metrics.

type Metric

type Metric struct {
	// UnixMilliseconds represents the Unix timestamp of the metric.
	UnixMilliseconds int64 `json:"unix_milliseconds"`
	// Component represents the name of the component this metric belongs to.
	Component string `json:"component"`
	// Name represents the name of the metric.
	Name string `json:"name"`
	// Value represents the numeric value of the metric.
	Value float64 `json:"value"`

	// Labels represents all the labels of the metric.
	Labels map[string]string `json:"labels,omitempty"`
}

Metric represents a metric row in the database table.

type Metrics

type Metrics []Metric

Metrics is a slice of Metric.

type Op

type Op struct {
	Since              time.Time
	SelectedComponents map[string]struct{}
}

func (*Op) ApplyOpts

func (op *Op) ApplyOpts(opts []OpOption) error

type OpOption

type OpOption func(*Op)

func WithComponents

func WithComponents(components ...string) OpOption

WithComponents sets the components to be scraped. If no components are provided, all components will be scraped.

func WithSince

func WithSince(t time.Time) OpOption

type Recorder

type Recorder interface {
	// Start starts the periodic metrics recorder.
	Start()
}

Recorder defines the metrics recorder interface.

type Scraper

type Scraper interface {
	Scrape(context.Context) (Metrics, error)
}

Scraper defines the metrics scraper interface.

type Store

type Store interface {
	// Record records metric data points.
	Record(ctx context.Context, ms ...Metric) error

	// Returns all the data points since the given time.
	// If since is zero, returns all metrics.
	Read(ctx context.Context, opts ...OpOption) (Metrics, error)

	// Purge purges the metrics data points before the given time.
	Purge(ctx context.Context, before time.Time) (int, error)
}

Store defines the metrics store interface.

Directories

Path Synopsis
Package recorder records internal GPUd metrics to Prometheus.
Package recorder records internal GPUd metrics to Prometheus.
Package scraper scrapes internal GPUd metrics from Prometheus.
Package scraper scrapes internal GPUd metrics from Prometheus.
Package store provides the persistent storage layer for the metrics.
Package store provides the persistent storage layer for the metrics.
Package syncer provides a syncer for the metrics.
Package syncer provides a syncer for the metrics.

Jump to

Keyboard shortcuts

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