Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
DefBuckets are the default histogram buckets. The default buckets are tailored to broadly measure the response time (in seconds) of a network service. Most likely, however, you will be required to define buckets customized to your use case.
Functions ¶
func ExponentialBuckets ¶
ExponentialBuckets creates 'count' buckets, where the lowest bucket has an upper bound of 'start' and each following bucket's upper bound is 'factor' times the previous bucket's upper bound. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field of HistogramOpts.
The function panics if 'count' is 0 or negative, if 'start' is 0 or negative, or if 'factor' is less than or equal 1.
func LinearBuckets ¶
LinearBuckets creates 'count' buckets, each 'width' wide, where the lowest bucket has an upper bound of 'start'. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field of HistogramOpts.
The function panics if 'count' is zero or negative.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a Metric that represents a single numerical bits that only ever goes up. That implies that it cannot be used to count items whose number can also go down, e.g. the number of currently running goroutines. Those "counters" are represented by Gauges.
A Counter is typically used to count requests served, tasks completed, errors occurred, etc.
type Gauge ¶
type Gauge float64
Gauge is a Metric that represents a single numerical value that can arbitrarily go up and down.
A Gauge is typically used for measured values like temperatures or current memory usage, but also "counts" that can go up and down, like the number of running goroutines.
func (*Gauge) Add ¶
Add adds the given bits to the atomicGauge. (The bits can be negative, resulting in a decrease of the atomicGauge.)
func (*Gauge) Dec ¶
func (g *Gauge) Dec()
Dec decrements the atomicGauge by 1. Use Sub to decrement it by arbitrary values.
func (*Gauge) Inc ¶
func (g *Gauge) Inc()
Inc increments the atomicGauge by 1. Use Add to increment it by arbitrary values.
func (*Gauge) SetToCurrentTime ¶
func (g *Gauge) SetToCurrentTime()
SetToCurrentTime sets the atomicGauge to the current Unix time in second.
type Histogram ¶
type Histogram interface { Observer }
A Histogram counts individual observations from an event or sample stream in configurable buckets. Similar to a summary, it also provides a sum of observations and an observation count.
Note that Histograms, in contrast to Summaries, can be aggregated. However, Histograms require the user to pre-define suitable buckets, and they are in general less accurate. The Observe method of a histogram has a very low performance overhead in comparison with the Observe method of a summary.
To create histogram instances, use NewHistogram.
func NewHistogram ¶
NewHistogram creates a new Histogram.
type Observer ¶
Observer is a interface that wraps the Observe method, which is used by Histogram and Summary to add observations.
type Summary ¶
type Summary interface { Observer Reset() }
A Summary captures individual observations from an event or sample stream and summarizes them in a manner similar to traditional summary statistics:
sum of observations observation count observation average.
To create summary instances, use NewSummary.