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() }
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 }
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(nowFunc func() time.Time, opts TimingHistogramOpts) (TimingHistogram, error)
NewTestableTimingHistogram creates a TimingHistogram that uses a mockable clock
func NewTimingHistogram(opts TimingHistogramOpts) (TimingHistogram, error)
NewTimingHistogram creates a new TimingHistogram
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 struct { *prometheus.MetricVec }
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
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(opts WeightedHistogramOpts) (WeightedHistogram, error)
NewWeightedHistogram creates a new WeightedHistogram
WeightedHistogramOpts is the same as for an ordinary Histogram
type WeightedHistogramOpts = prometheus.HistogramOpts
WeightedHistogramVec implements WeightedObserverVec
type WeightedHistogramVec struct { *prometheus.MetricVec }
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
WeightedObserver generalizes the Observer interface.
type WeightedObserver interface { // Set the variable to the given value with the given weight. ObserveWithWeight(value float64, weight uint64) }
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 }