Documentation ¶
Overview ¶
Package metrics provides storage for metrics being recorded by mtail programs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // MetricUpdateTime contains the timestamp of the last update of a metric. // TODO(jaq): move this global value to be a property of the Store. MetricUpdateTime atomic.Value )
Functions ¶
This section is empty.
Types ¶
type Datum ¶
Datum describes a LabelSet's or LabelValue's value at a given timestamp.
type Incrementable ¶
Incrementable describes an interface for Counter MetricTypes, that must be nondecreasing.
type LabelSet ¶
LabelSet is an object that maps the keys of a Metric to the labels naming a Datum, for use when enumerating Datums from a Metric.
type LabelValue ¶
LabelValue is an object that names a Datum value with a list of label strings.
func (*LabelValue) String ¶
func (lv *LabelValue) String() string
type Metric ¶
type Metric struct { sync.RWMutex Name string // Name Program string // Instantiating program Kind MetricType Keys []string `json:",omitempty"` LabelValues []*LabelValue `json:",omitempty"` }
Metric is an object that describes a metric, with its name, the creator and owner program name, its MetricType, a sequence of Keys that may be used to add dimension to the metric, and a list of LabelValues that contain data for labels in each dimension of the Keys.
func NewMetric ¶
func NewMetric(name string, prog string, kind MetricType, keys ...string) *Metric
NewMetric returns a new empty metric of dimension len(keys).
func (*Metric) EmitLabelSets ¶
EmitLabelSets enumerates the LabelSets corresponding to the LabelValues of a Metric. It emits them onto the provided channel, then closes the channel to signal completion.
type MetricType ¶
type MetricType int
MetricType enumerates the types of metrics supported.
const ( // Counter is a MetricType that is nondecreasing, typically only // incrementable. Counter MetricType = iota // Gauge is a MetricType that can take on any value, and may be set // discontinuously from its previous value. Gauge )
func (MetricType) String ¶
func (m MetricType) String() string
type Settable ¶
Settable describes an interface for Gauge MetricTypes, that can be set to any value discontinuously from its previous.