Package metrics
Overview ▹
Index ▹
type Counter ¶
Counter describes a metric that accumulates values monotonically. An example of a counter is the number of received HTTP requests.
type Counter interface {
With(labelValues ...string) Counter
Add(delta float64)
}
type Gauge ¶
Gauge describes a metric that takes specific values over time. An example of a gauge is the current depth of a job queue.
type Gauge interface {
With(labelValues ...string) Gauge
Set(value float64)
Add(delta float64)
}
type Histogram ¶
Histogram describes a metric that takes repeated observations of the same kind of thing, and produces a statistical summary of those observations, typically expressed as quantiles or buckets. An example of a histogram is HTTP request latencies.
type Histogram interface {
With(labelValues ...string) Histogram
Observe(value float64)
}
type Timer ¶
Timer acts as a stopwatch, sending observations to a wrapped histogram. It's a bit of helpful syntax sugar for h.Observe(time.Since(x)).
type Timer struct {
// contains filtered or unexported fields
}
func NewTimer ¶
func NewTimer(h Histogram) *Timer
NewTimer wraps the given histogram and records the current time.
func (*Timer) ObserveDuration ¶
func (t *Timer) ObserveDuration()
ObserveDuration captures the number of seconds since the timer was constructed, and forwards that observation to the histogram.
Subdirectories
| Name | Synopsis |
|---|---|
| .. | |
| discard | Package discard provides a no-op metrics backend. |
| dogstatsd | Package dogstatsd provides a DogStatsD backend for package metrics. |
| expvar | Package expvar provides expvar backends for metrics. |
| generic | Package generic implements generic versions of each of the metric types. |
| graphite | Package graphite provides a Graphite backend for metrics. |
| influx | Package influx provides an InfluxDB implementation for metrics. |
| multi | Package multi provides adapters that send observations to multiple metrics simultaneously. |
| pcp | |
| prometheus | Package prometheus provides Prometheus implementations for metrics. |
| provider | Package provider provides a factory-like abstraction for metrics backends. |
| statsd | Package statsd provides a StatsD backend for package metrics. |
| teststat | Package teststat provides helpers for testing metrics backends. |
ActiveGo 1.8