package generic
import "github.com/go-kit/kit/metrics/generic"
Package generic implements generic versions of each of the metric types. They can be embedded by other implementations, and converted to specific formats as necessary.
Index ¶
- type Bucket
- type Counter
- func NewCounter(name string) *Counter
- func (c *Counter) Add(delta float64)
- func (c *Counter) LabelValues() []string
- func (c *Counter) Value() float64
- func (c *Counter) ValueReset() float64
- func (c *Counter) With(labelValues ...string) metrics.Counter
- type Gauge
- func NewGauge(name string) *Gauge
- func (g *Gauge) Add(delta float64)
- func (g *Gauge) LabelValues() []string
- func (g *Gauge) Set(value float64)
- func (g *Gauge) Value() float64
- func (g *Gauge) With(labelValues ...string) metrics.Gauge
- type Histogram
- func NewHistogram(name string, buckets int) *Histogram
- func (h *Histogram) LabelValues() []string
- func (h *Histogram) Observe(value float64)
- func (h *Histogram) Print(w io.Writer)
- func (h *Histogram) Quantile(q float64) float64
- func (h *Histogram) With(labelValues ...string) metrics.Histogram
- type Quantile
- type SimpleHistogram
Types ¶
type Bucket ¶
type Bucket struct { From, To, Count int64 }
Bucket is a range in a histogram which aggregates observations.
type Counter ¶
type Counter struct { Name string // contains filtered or unexported fields }
Counter is an in-memory implementation of a Counter.
func NewCounter ¶
NewCounter returns a new, usable Counter.
func (*Counter) Add ¶
Add implements Counter.
func (*Counter) LabelValues ¶
LabelValues returns the set of label values attached to the counter.
func (*Counter) Value ¶
Value returns the current value of the counter.
func (*Counter) ValueReset ¶
ValueReset 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 ¶
With implements Counter.
type Gauge ¶
type Gauge struct { Name string // contains filtered or unexported fields }
Gauge is an in-memory implementation of a Gauge.
func NewGauge ¶
NewGauge returns a new, usable Gauge.
func (*Gauge) Add ¶
Add implements metrics.Gauge.
func (*Gauge) LabelValues ¶
LabelValues returns the set of label values attached to the gauge.
func (*Gauge) Set ¶
Set implements Gauge.
func (*Gauge) Value ¶
Value returns the current value of the gauge.
func (*Gauge) With ¶
With implements Gauge.
type Histogram ¶
type Histogram struct { Name string // contains filtered or unexported fields }
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.
func NewHistogram ¶
NewHistogram returns a numeric histogram based on VividCortex/gohistogram. A good default value for buckets is 50.
func (*Histogram) LabelValues ¶
LabelValues returns the set of label values attached to the histogram.
func (*Histogram) Observe ¶
Observe implements Histogram.
func (*Histogram) Print ¶
Print writes a string representation of the histogram to the passed writer. Useful for printing to a terminal.
func (*Histogram) Quantile ¶
Quantile returns the value of the quantile q, 0.0 < q < 1.0.
func (*Histogram) With ¶
With implements Histogram.
type Quantile ¶
Quantile is a pair of a quantile (0..100) and its observed maximum value.
type SimpleHistogram ¶
type SimpleHistogram struct {
// contains filtered or unexported fields
}
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.
func NewSimpleHistogram ¶
func NewSimpleHistogram() *SimpleHistogram
NewSimpleHistogram returns a SimpleHistogram, ready for observations.
func (*SimpleHistogram) ApproximateMovingAverage ¶
func (h *SimpleHistogram) ApproximateMovingAverage() float64
ApproximateMovingAverage returns the approximate moving average of observations.
func (*SimpleHistogram) LabelValues ¶
func (h *SimpleHistogram) LabelValues() []string
LabelValues 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.Histogram
With implements Histogram.
Source Files ¶
- Version
- v0.13.0 (latest)
- Published
- May 29, 2023
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 4 hours ago –
Tools for package owners.