Import path:
gitlab.soludian.com/soludian/fountain/libs/metrics/generic
generic
import "gitlab.soludian.com/soludian/fountain/libs/metrics/generic"Index
Variables
var KPackageName = "generic"type Bucket
Bucket is a range in a histogram which aggregates observations.
type Bucket struct {
From, To, Count int64
}type Counter
Counter is an in-memory implementation of a Counter.
type Counter struct {
Name string
// contains filtered or unexported fields
}func NewCounter
func NewCounter(name string) *CounterNewCounter returns a new, usable Counter.
func (*Counter) Add
func (c *Counter) Add(delta float64)Add implements Counter.
func (*Counter) LabelValues
func (c *Counter) LabelValues() []stringLabelValues returns the set of label values attached to the counter.
func (*Counter) Value
func (c *Counter) Value() float64Value returns the current value of the counter.
func (*Counter) ValueReset
func (c *Counter) ValueReset() float64ValueReset returns the current value of the counter, and resets it to zero. This is useful for metrics backends whose counter aggregations expect deltas, like Graphite.
func (*Counter) With
func (c *Counter) With(labelValues ...string) metrics.CounterWith implements Counter.
type Gauge
Gauge is an in-memory implementation of a Gauge.
type Gauge struct {
Name string
// contains filtered or unexported fields
}func NewGauge
func NewGauge(name string) *GaugeNewGauge returns a new, usable Gauge.
func (*Gauge) Add
func (g *Gauge) Add(delta float64)Add implements metrics.Gauge.
func (*Gauge) LabelValues
func (g *Gauge) LabelValues() []stringLabelValues returns the set of label values attached to the gauge.
func (*Gauge) Set
func (g *Gauge) Set(value float64)Set implements Gauge.
func (*Gauge) Value
func (g *Gauge) Value() float64Value returns the current value of the gauge.
func (*Gauge) With
func (g *Gauge) With(labelValues ...string) metrics.GaugeWith implements Gauge.
type Histogram
Histogram is an in-memory implementation of a streaming histogram, based on VividCortex/gohistogram. It dynamically computes quantiles, so it's not suitable for aggregation.
type Histogram struct {
Name string
// contains filtered or unexported fields
}func NewHistogram
func NewHistogram(name string, buckets int) *HistogramNewHistogram returns a numeric histogram based on VividCortex/gohistogram. A good default value for buckets is 50.
func (*Histogram) LabelValues
func (h *Histogram) LabelValues() []stringLabelValues returns the set of label values attached to the histogram.
func (*Histogram) Observe
func (h *Histogram) Observe(value float64)Observe implements Histogram.
func (*Histogram) Print
func (h *Histogram) Print(w io.Writer)Print writes a string representation of the histogram to the passed writer. Useful for printing to a terminal.
func (*Histogram) Quantile
func (h *Histogram) Quantile(q float64) float64Quantile returns the value of the quantile q, 0.0 < q < 1.0.
func (*Histogram) With
func (h *Histogram) With(labelValues ...string) metrics.HistogramWith implements Histogram.
type Quantile
Quantile is a pair of a quantile (0..100) and its observed maximum value.
type Quantile struct {
Quantile int // 0..100
Value int64
}type SimpleHistogram
SimpleHistogram is an in-memory implementation of a Histogram. It only tracks an approximate moving average, so is likely too naïve for many use cases.
type SimpleHistogram struct {
// contains filtered or unexported fields
}func NewSimpleHistogram
func NewSimpleHistogram() *SimpleHistogramNewSimpleHistogram returns a SimpleHistogram, ready for observations.
func (*SimpleHistogram) ApproximateMovingAverage
func (h *SimpleHistogram) ApproximateMovingAverage() float64ApproximateMovingAverage returns the approximate moving average of observations.
func (*SimpleHistogram) LabelValues
func (h *SimpleHistogram) LabelValues() []stringLabelValues returns the set of label values attached to the histogram.
func (*SimpleHistogram) Observe
func (h *SimpleHistogram) Observe(value float64)Observe implements Histogram.
func (*SimpleHistogram) With
func (h *SimpleHistogram) With(labelValues ...string) metrics.HistogramWith implements Histogram.
Generated by gomarkdoc