...

Package prometheusextension

import "k8s.io/component-base/metrics/prometheusextension"
Overview
Index

Overview ▾

Index ▾

type GaugeOps
type GaugeVecOps
type TimingHistogram
    func NewTestableTimingHistogram(nowFunc func() time.Time, opts TimingHistogramOpts) (TimingHistogram, error)
    func NewTimingHistogram(opts TimingHistogramOpts) (TimingHistogram, error)
type TimingHistogramOpts
type TimingHistogramVec
    func NewTestableTimingHistogramVec(nowFunc func() time.Time, opts TimingHistogramOpts, labelNames ...string) *TimingHistogramVec
    func NewTimingHistogramVec(opts TimingHistogramOpts, labelNames ...string) *TimingHistogramVec
    func (hv *TimingHistogramVec) CurryWith(labels prometheus.Labels) (GaugeVecOps, error)
    func (hv *TimingHistogramVec) GetMetricWith(labels prometheus.Labels) (GaugeOps, error)
    func (hv *TimingHistogramVec) GetMetricWithLabelValues(lvs ...string) (GaugeOps, error)
    func (hv *TimingHistogramVec) MustCurryWith(labels prometheus.Labels) GaugeVecOps
    func (hv *TimingHistogramVec) With(labels prometheus.Labels) GaugeOps
    func (hv *TimingHistogramVec) WithLabelValues(lvs ...string) GaugeOps
type WeightedHistogram
    func NewWeightedHistogram(opts WeightedHistogramOpts) (WeightedHistogram, error)
type WeightedHistogramOpts
type WeightedHistogramVec
    func NewWeightedHistogramVec(opts WeightedHistogramOpts, labelNames ...string) *WeightedHistogramVec
    func (hv *WeightedHistogramVec) CurryWith(labels prometheus.Labels) (WeightedObserverVec, error)
    func (hv *WeightedHistogramVec) GetMetricWith(labels prometheus.Labels) (WeightedObserver, error)
    func (hv *WeightedHistogramVec) GetMetricWithLabelValues(lvs ...string) (WeightedObserver, error)
    func (hv *WeightedHistogramVec) MustCurryWith(labels prometheus.Labels) WeightedObserverVec
    func (hv *WeightedHistogramVec) With(labels prometheus.Labels) WeightedObserver
    func (hv *WeightedHistogramVec) WithLabelValues(lvs ...string) WeightedObserver
type WeightedObserver
type WeightedObserverVec

Package files

timing_histogram.go timing_histogram_vec.go weighted_histogram.go weighted_histogram_vec.go

type GaugeOps

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 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()
}

type GaugeVecOps

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

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
}

type TimingHistogram

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.

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

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

TimingHistogramOpts is the parameters of the TimingHistogram constructor

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
}

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

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.

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

func NewWeightedHistogram

func NewWeightedHistogram(opts WeightedHistogramOpts) (WeightedHistogram, error)

NewWeightedHistogram creates a new WeightedHistogram

type WeightedHistogramOpts

WeightedHistogramOpts is the same as for an ordinary Histogram

type WeightedHistogramOpts = prometheus.HistogramOpts

type WeightedHistogramVec

WeightedHistogramVec implements WeightedObserverVec

type WeightedHistogramVec struct {
    *prometheus.MetricVec
}

func NewWeightedHistogramVec

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

func (*WeightedHistogramVec) CurryWith

func (hv *WeightedHistogramVec) CurryWith(labels prometheus.Labels) (WeightedObserverVec, error)

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 (hv *WeightedHistogramVec) With(labels prometheus.Labels) WeightedObserver

func (*WeightedHistogramVec) WithLabelValues

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

type WeightedObserver

WeightedObserver generalizes the Observer interface.

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

type WeightedObserverVec

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

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
}