prom

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetricSet

func NewMetricSet(name, help string) *metricSet

func NewPrometheusClient added in v1.2.0

func NewPrometheusClient(prometheusURL string) (api.Client, error)

func NewPrometheusClientWithRoundTripper added in v1.2.0

func NewPrometheusClientWithRoundTripper(prometheusURL string, roundTripper http.RoundTripper) (api.Client, error)

NewPrometheusClientWithRoundTripper creates a client using a supplied transport for authentication and TLS.

func NewPrometheusClientWithToken added in v1.2.0

func NewPrometheusClientWithToken(prometheusURL string, token string) (api.Client, error)

Types

type Loader

type Loader interface {
	LoadQuery(ctx context.Context, query string, t time.Time) ([]model.LabelSet, error)
	LoadAlertsRange(ctx context.Context, start, end time.Time, step time.Duration) (RangeVector, error)
	LoadVectorRange(ctx context.Context, query string, start, end time.Time, step time.Duration) (RangeVector, error)
}

func NewLoader

func NewLoader(prometheusURL string) (Loader, error)

func NewLoaderWithRoundTripper added in v1.2.0

func NewLoaderWithRoundTripper(prometheusURL string, roundTripper http.RoundTripper) (Loader, error)

NewLoaderWithRoundTripper creates a loader using a supplied transport.

func NewLoaderWithToken added in v1.2.0

func NewLoaderWithToken(prometheusURL, token string) (Loader, error)

type Matrix

type Matrix struct {
	Metrics []model.LabelSet
	Values  [][]model.SampleValue
	Start   model.Time
	End     model.Time
	Step    time.Duration
}

Matrix is a dense matrix of time series aligned by time.

type Metric

type Metric struct {
	Labels model.LabelSet
	Value  float64
}

type MetricSet

type MetricSet interface {
	prom.Collector
	Update(metrics []Metric)
}

MetricSet is an expasion of prometheus.Collector interface that allows batch updates of metrics. Useful when processing a set of metrics that are later exposed to Prometheus via different metric.

type Range

type Range struct {
	Metric  model.LabelSet
	Samples []model.SamplePair
	Step    time.Duration
}

type RangeVector

type RangeVector []Range

func (RangeVector) Expand

func (v RangeVector) Expand() Matrix

Expand converts a RangeVector to a dense Matrix.

The dense matrix is quite an expensive structure. We initially used it for searching for alerts changes, but we used interval-based approach instead. We keep this function for possible future use.

func (RangeVector) MaxTime

func (v RangeVector) MaxTime() model.Time

func (RangeVector) MinTime

func (v RangeVector) MinTime() model.Time

Jump to

Keyboard shortcuts

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