prometheusextension

package
v0.31.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GaugeOps

type GaugeOps interface {
	// Set is the same as Gauge.Set
	Set(float64)
	// Inc is the same as Gauge.inc
	Inc()
	// Dec is the same as Gauge.Dec
	Dec()
	// Add is the same as Gauge.Add
	Add(float64)
	// Sub is the same as Gauge.Sub
	Sub(float64)

	// SetToCurrentTime the same as Gauge.SetToCurrentTime
	SetToCurrentTime()
}

GaugeOps is the part of `prometheus.Gauge` that is relevant to instrumented code. This factoring should be in prometheus, analogous to the way it already factors out the Observer interface for histograms and summaries.

type GaugeVecOps

type GaugeVecOps interface {
	GetMetricWith(prometheus.Labels) (GaugeOps, error)
	GetMetricWithLabelValues(lvs ...string) (GaugeOps, error)
	With(prometheus.Labels) GaugeOps
	WithLabelValues(...string) GaugeOps
	CurryWith(prometheus.Labels) (GaugeVecOps, error)
	MustCurryWith(prometheus.Labels) GaugeVecOps
}

GaugeVecOps is a bunch of Gauge that have the same Desc and are distinguished by the values for their variable labels.

type TimingHistogram

type TimingHistogram interface {
	prometheus.Metric
	prometheus.Collector
	GaugeOps
}

A TimingHistogram tracks how long a `float64` variable spends in ranges defined by buckets. Time is counted in nanoseconds. The histogram's sum is the integral over time (in nanoseconds, from creation of the histogram) of the variable's value.

func NewTestableTimingHistogram

func NewTestableTimingHistogram(nowFunc func() time.Time, opts TimingHistogramOpts) (TimingHistogram, error)

NewTestableTimingHistogram creates a TimingHistogram that uses a mockable clock

func NewTimingHistogram

func NewTimingHistogram(opts TimingHistogramOpts) (TimingHistogram, error)

NewTimingHistogram creates a new TimingHistogram

type TimingHistogramOpts

type TimingHistogramOpts struct {
	Namespace   string
	Subsystem   string
	Name        string
	Help        string
	ConstLabels prometheus.Labels

	// Buckets defines the buckets into which observations are
	// accumulated. Each element in the slice is the upper
	// inclusive bound of a bucket. The values must be sorted in
	// strictly increasing order. There is no need to add a
	// highest bucket with +Inf bound. The default value is
	// prometheus.DefBuckets.
	Buckets []float64

	// The initial value of the variable.
	InitialValue float64
}

TimingHistogramOpts is the parameters of the TimingHistogram constructor

type TimingHistogramVec

type TimingHistogramVec struct {
	*prometheus.MetricVec
}

func NewTestableTimingHistogramVec

func NewTestableTimingHistogramVec(nowFunc func() time.Time, opts TimingHistogramOpts, labelNames ...string) *TimingHistogramVec

func NewTimingHistogramVec

func NewTimingHistogramVec(opts TimingHistogramOpts, labelNames ...string) *TimingHistogramVec

func (*TimingHistogramVec) CurryWith

func (hv *TimingHistogramVec) CurryWith(labels prometheus.Labels) (GaugeVecOps, error)

func (*TimingHistogramVec) GetMetricWith

func (hv *TimingHistogramVec) GetMetricWith(labels prometheus.Labels) (GaugeOps, error)

func (*TimingHistogramVec) GetMetricWithLabelValues

func (hv *TimingHistogramVec) GetMetricWithLabelValues(lvs ...string) (GaugeOps, error)

func (*TimingHistogramVec) MustCurryWith

func (hv *TimingHistogramVec) MustCurryWith(labels prometheus.Labels) GaugeVecOps

func (*TimingHistogramVec) With

func (hv *TimingHistogramVec) With(labels prometheus.Labels) GaugeOps

func (*TimingHistogramVec) WithLabelValues

func (hv *TimingHistogramVec) WithLabelValues(lvs ...string) GaugeOps

type WeightedHistogram

type WeightedHistogram interface {
	prometheus.Metric
	prometheus.Collector
	WeightedObserver
}

WeightedHistogram generalizes Histogram: each observation has an associated _weight_. For a given `x` and `N`, `1` call on `ObserveWithWeight(x, N)` has the same meaning as `N` calls on `ObserveWithWeight(x, 1)`. The weighted sum might differ slightly due to the use of floating point, although the implementation takes some steps to mitigate that. If every weight were 1, this would be the same as the existing Histogram abstraction.

func NewWeightedHistogram

func NewWeightedHistogram(opts WeightedHistogramOpts) (WeightedHistogram, error)

NewWeightedHistogram creates a new WeightedHistogram

type WeightedHistogramOpts

type WeightedHistogramOpts = prometheus.HistogramOpts

WeightedHistogramOpts is the same as for an ordinary Histogram

type WeightedHistogramVec

type WeightedHistogramVec struct {
	*prometheus.MetricVec
}

WeightedHistogramVec implements WeightedObserverVec

func NewWeightedHistogramVec

func NewWeightedHistogramVec(opts WeightedHistogramOpts, labelNames ...string) *WeightedHistogramVec

func (*WeightedHistogramVec) CurryWith

func (*WeightedHistogramVec) GetMetricWith

func (hv *WeightedHistogramVec) GetMetricWith(labels prometheus.Labels) (WeightedObserver, error)

func (*WeightedHistogramVec) GetMetricWithLabelValues

func (hv *WeightedHistogramVec) GetMetricWithLabelValues(lvs ...string) (WeightedObserver, error)

func (*WeightedHistogramVec) MustCurryWith

func (hv *WeightedHistogramVec) MustCurryWith(labels prometheus.Labels) WeightedObserverVec

func (*WeightedHistogramVec) With

func (*WeightedHistogramVec) WithLabelValues

func (hv *WeightedHistogramVec) WithLabelValues(lvs ...string) WeightedObserver

type WeightedObserver

type WeightedObserver interface {
	// Set the variable to the given value with the given weight.
	ObserveWithWeight(value float64, weight uint64)
}

WeightedObserver generalizes the Observer interface.

type WeightedObserverVec

type WeightedObserverVec interface {
	GetMetricWith(prometheus.Labels) (WeightedObserver, error)
	GetMetricWithLabelValues(lvs ...string) (WeightedObserver, error)
	With(prometheus.Labels) WeightedObserver
	WithLabelValues(...string) WeightedObserver
	CurryWith(prometheus.Labels) (WeightedObserverVec, error)
	MustCurryWith(prometheus.Labels) WeightedObserverVec
}

WeightedObserverVec is a bunch of WeightedObservers that have the same Desc and are distinguished by the values for their variable labels.

Jump to

Keyboard shortcuts

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