Documentation
¶
Overview ¶
Package metrics defines a concurrently-accessible metrics collector.
A *metrics.M value exports methods to track integer counters and maximum values. A metric has a caller-assigned string name that is not interpreted by the collector except to locate its stored value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type M ¶
type M struct {
// contains filtered or unexported fields
}
An M collects counters and maximum value trackers. A nil *M is valid, and discards all metrics. The methods of an *M are safe for concurrent use by multiple goroutines.
func (*M) Count ¶
Count adds n to the current value of the counter named, defining the counter if it does not already exist.
func (*M) CountAndSetMax ¶
CountAndSetMax adds n to the current value of the counter named, and also updates a max value tracker with the same name in a single step.
func (*M) SetLabel ¶
SetLabel sets the specified label to value. If value == "" the label is removed from the set.
func (*M) SetMaxValue ¶
SetMaxValue sets the maximum value metric named to the greater of n and its current value, defining the value if it does not already exist.