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) EditLabel ¶ added in v0.26.1
EditLabel calls edit with the current value of the specified label. The value returned by edit replaces the contents of the label. If edit returns nil, the label is removed from the set. If the label did not exist, the argument to edit is nil.
func (*M) SetLabel ¶
SetLabel sets the specified label to value. If value == nil the label is removed from the set.
As a special case, if value has the concrete type
func() interface{}
then the value of the label is obtained by calling that function.
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.