Documentation
¶
Overview ¶
Package metric aggregates events into metrics that can be exported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Entries = keys.New("metric_entries", "The set of metrics calculated for an event")
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data interface {
// Handle returns the metric handle this data is for.
//TODO: rethink the concept of metric handles
Handle() string
// Groups reports the rows that currently exist for this metric.
Groups() [][]label.Label
}
Data represents a single point in the time series of a metric. This provides the common interface to all metrics no matter their data format. To get the actual values for the metric you must type assert to a concrete metric type.
type Float64Data ¶
type Float64Data struct {
// Info holds the original construction information.
Info *Scalar
// IsGauge is true for metrics that track values, rather than increasing over time.
IsGauge bool
// Rows holds the per group values for the metric.
Rows []float64
// End is the last time this metric was updated.
EndTime time.Time
// contains filtered or unexported fields
}
Float64Data is a concrete implementation of Data for float64 scalar metrics.
func (*Float64Data) Groups ¶
func (data *Float64Data) Groups() [][]label.Label
func (*Float64Data) Handle ¶
func (data *Float64Data) Handle() string
type HistogramFloat64 ¶
type HistogramFloat64 struct {
// Name is the unique name of this metric.
Name string
// Description can be used by observers to describe the metric to users.
Description string
// Keys is the set of labels that collectively describe rows of the metric.
Keys []label.Key
// Buckets holds the inclusive upper bound of each bucket in the histogram.
Buckets []float64
}
HistogramFloat64 represents the construction information for an float64 histogram metric.
type HistogramFloat64Data ¶
type HistogramFloat64Data struct {
// Info holds the original construction information.
Info *HistogramFloat64
// Rows holds the per group values for the metric.
Rows []*HistogramFloat64Row
// End is the last time this metric was updated.
EndTime time.Time
// contains filtered or unexported fields
}
HistogramFloat64Data is a concrete implementation of Data for float64 histogram metrics.
func (*HistogramFloat64Data) Groups ¶
func (data *HistogramFloat64Data) Groups() [][]label.Label
func (*HistogramFloat64Data) Handle ¶
func (data *HistogramFloat64Data) Handle() string
type HistogramFloat64Row ¶
type HistogramFloat64Row struct {
// Values is the counts per bucket.
Values []int64
// Count is the total count.
Count int64
// Sum is the sum of all the values recorded.
Sum float64
// Min is the smallest recorded value.
Min float64
// Max is the largest recorded value.
Max float64
}
HistogramFloat64Row holds the values for a single row of a HistogramFloat64Data.
type HistogramInt64 ¶
type HistogramInt64 struct {
// Name is the unique name of this metric.
Name string
// Description can be used by observers to describe the metric to users.
Description string
// Keys is the set of labels that collectively describe rows of the metric.
Keys []label.Key
// Buckets holds the inclusive upper bound of each bucket in the histogram.
Buckets []int64
}
HistogramInt64 represents the construction information for an int64 histogram metric.
type HistogramInt64Data ¶
type HistogramInt64Data struct {
// Info holds the original construction information.
Info *HistogramInt64
// Rows holds the per group values for the metric.
Rows []*HistogramInt64Row
// End is the last time this metric was updated.
EndTime time.Time
// contains filtered or unexported fields
}
HistogramInt64Data is a concrete implementation of Data for int64 histogram metrics.
func (*HistogramInt64Data) Groups ¶
func (data *HistogramInt64Data) Groups() [][]label.Label
func (*HistogramInt64Data) Handle ¶
func (data *HistogramInt64Data) Handle() string
type HistogramInt64Row ¶
type HistogramInt64Row struct {
// Values is the counts per bucket.
Values []int64
// Count is the total count.
Count int64
// Sum is the sum of all the values recorded.
Sum int64
// Min is the smallest recorded value.
Min int64
// Max is the largest recorded value.
Max int64
}
HistogramInt64Row holds the values for a single row of a HistogramInt64Data.
type Int64Data ¶
type Int64Data struct {
// Info holds the original construction information.
Info *Scalar
// IsGauge is true for metrics that track values, rather than increasing over time.
IsGauge bool
// Rows holds the per group values for the metric.
Rows []int64
// End is the last time this metric was updated.
EndTime time.Time
// contains filtered or unexported fields
}
Int64Data is a concrete implementation of Data for int64 scalar metrics.
type Scalar ¶
type Scalar struct {
// Name is the unique name of this metric.
Name string
// Description can be used by observers to describe the metric to users.
Description string
// Keys is the set of labels that collectively describe rows of the metric.
Keys []label.Key
}
Scalar represents the construction information for a scalar metric.
func (Scalar) Count ¶
Count creates a new metric based on the Scalar information that counts the number of times the supplied int64 measure is set. Metrics of this type will use Int64Data.
func (Scalar) LatestFloat64 ¶
LatestFloat64 creates a new metric based on the Scalar information that tracks the most recent value recorded on the float64 measure. Metrics of this type will use Float64Data.
func (Scalar) LatestInt64 ¶
LatestInt64 creates a new metric based on the Scalar information that tracks the most recent value recorded on the int64 measure. Metrics of this type will use Int64Data.
func (Scalar) SumFloat64 ¶
SumFloat64 creates a new metric based on the Scalar information that sums all the values recorded on the float64 measure. Metrics of this type will use Float64Data.