metrics

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpireTime = 5 * time.Minute
	DefaultGCInterval = 1 * time.Minute
)

Variables

This section is empty.

Functions

func MergedGatherFunc added in v1.4.1

func MergedGatherFunc(g ...prometheus.Gatherer) prometheus.Gatherer

MergedGatherFunc returns a Gatherer that merges the results of multiple Gatherers

Types

type GCCounterVec

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

func NewGCCounterVec

func NewGCCounterVec(name string, vec *prometheus.CounterVec) *GCCounterVec

func (*GCCounterVec) Delete added in v1.4.0

func (g *GCCounterVec) Delete(labels prometheus.Labels)

func (*GCCounterVec) GetCounterVec

func (g *GCCounterVec) GetCounterVec() *prometheus.CounterVec

func (*GCCounterVec) WithInc

func (g *GCCounterVec) WithInc(labels prometheus.Labels)

type GCGaugeVec

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

func NewGCGaugeVec

func NewGCGaugeVec(name string, vec *prometheus.GaugeVec) *GCGaugeVec

func (*GCGaugeVec) Delete added in v1.4.0

func (g *GCGaugeVec) Delete(labels prometheus.Labels)

func (*GCGaugeVec) GetGaugeVec

func (g *GCGaugeVec) GetGaugeVec() *prometheus.GaugeVec

func (*GCGaugeVec) WithSet

func (g *GCGaugeVec) WithSet(labels prometheus.Labels, value float64)

type MetricGC

type MetricGC interface {
	Run()
	Stop()
	AddMetric(name string, metric *prometheus.MetricVec)
	UpdateStatus(name string, labels prometheus.Labels)
	RemoveStatus(name string, labels prometheus.Labels)
	CountStatus(name string) int
}

func NewMetricGC

func NewMetricGC(expireTime time.Duration, interval time.Duration) MetricGC

type MetricVecGC

type MetricVecGC interface {
	// Len returns the length of the alive metric statuses.
	Len() int
	// UpdateStatus updates the metric status with the given label values and timestamp (Unix seconds).
	UpdateStatus(updateTime int64, labels prometheus.Labels)
	// RemoveStatus removes the metric status with the given label values.
	RemoveStatus(labels prometheus.Labels)
	// ExpireMetrics expires all metric statuses which are updated before the expired time (Unix seconds).
	ExpireMetrics(expireTime int64) int
}

func NewMetricVecGC

func NewMetricVecGC(name string, metricVec *prometheus.MetricVec) MetricVecGC

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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