Documentation
¶
Overview ¶
Package metric aggregates stats into metrics that can be exported.
Index ¶
- func RegisterObservers(e ...Observer)
- type Data
- type Float64Data
- type Handle
- type HistogramFloat64
- type HistogramFloat64Data
- type HistogramFloat64Row
- type HistogramInt64
- type HistogramInt64Data
- type HistogramInt64Row
- type Int64Data
- type Observer
- type Scalar
- func (info Scalar) CountFloat64(measure *stats.Float64Measure) Handle
- func (info Scalar) CountInt64(measure *stats.Int64Measure) Handle
- func (info Scalar) LatestFloat64(measure *stats.Float64Measure) Handle
- func (info Scalar) LatestInt64(measure *stats.Int64Measure) Handle
- func (info Scalar) SumFloat64(measure *stats.Float64Measure) Handle
- func (info Scalar) SumInt64(measure *stats.Int64Measure) Handle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterObservers ¶
func RegisterObservers(e ...Observer)
RegisterObservers adds a new metric observer to the system. There is no way to unregister an observer.
Types ¶
type Data ¶
type Data interface { // Handle returns the metric handle this data is for. Handle() Handle // Groups reports the rows that currently exist for this metric. Groups() []tag.List }
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 consruction 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 // contains filtered or unexported fields }
Float64Data is a concrete implementation of Data for float64 scalar metrics.
func (*Float64Data) Groups ¶
func (data *Float64Data) Groups() []tag.List
func (*Float64Data) Handle ¶
func (data *Float64Data) Handle() Handle
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle uniquely identifies a constructed metric. It can be used to detect which observed data objects belong to that metric.
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 tags that collectively describe rows of the metric. Keys []interface{} // Buckets holds the inclusive upper bound of each bucket in the histogram. Buckets []float64 }
HistogramFloat64 represents the construction information for an float64 histogram metric.
func (HistogramFloat64) Record ¶
func (info HistogramFloat64) Record(measure *stats.Float64Measure) Handle
Record creates a new metric based on the HistogramFloat64 information that tracks the bucketized counts of values recorded on the float64 measure. Metrics of this type will use HistogramFloat64Data.
type HistogramFloat64Data ¶
type HistogramFloat64Data struct { // Info holds the original consruction information. Info *HistogramFloat64 // Rows holds the per group values for the metric. Rows []*HistogramFloat64Row // contains filtered or unexported fields }
HistogramFloat64Data is a concrete implementation of Data for float64 histogram metrics.
func (*HistogramFloat64Data) Groups ¶
func (data *HistogramFloat64Data) Groups() []tag.List
func (*HistogramFloat64Data) Handle ¶
func (data *HistogramFloat64Data) Handle() Handle
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 tags that collectively describe rows of the metric. Keys []interface{} // Buckets holds the inclusive upper bound of each bucket in the histogram. Buckets []int64 }
HistogramInt64 represents the construction information for an int64 histogram metric.
func (HistogramInt64) Record ¶
func (info HistogramInt64) Record(measure *stats.Int64Measure) Handle
Record creates a new metric based on the HistogramInt64 information that tracks the bucketized counts of values recorded on the int64 measure. Metrics of this type will use HistogramInt64Data.
type HistogramInt64Data ¶
type HistogramInt64Data struct { // Info holds the original consruction information. Info *HistogramInt64 // Rows holds the per group values for the metric. Rows []*HistogramInt64Row // contains filtered or unexported fields }
HistogramInt64Data is a concrete implementation of Data for int64 histogram metrics.
func (*HistogramInt64Data) Groups ¶
func (data *HistogramInt64Data) Groups() []tag.List
func (*HistogramInt64Data) Handle ¶
func (data *HistogramInt64Data) Handle() Handle
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 consruction 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 // contains filtered or unexported fields }
Int64Data is a concrete implementation of Data for int64 scalar metrics.
type Observer ¶
type Observer func(Data)
Observer is the type for functions that want to observe metric values as they arrive. Each data point delivered to an observer is immutable and can be stored if needed.
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 tags that collectively describe rows of the metric. Keys []interface{} }
Scalar represents the construction information for a scalar metric.
func (Scalar) CountFloat64 ¶
func (info Scalar) CountFloat64(measure *stats.Float64Measure) Handle
CountFloat64 creates a new metric based on the Scalar information that counts the number of times the supplied float64 measure is set. Metrics of this type will use Int64Data.
func (Scalar) CountInt64 ¶
func (info Scalar) CountInt64(measure *stats.Int64Measure) Handle
CountInt64 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 ¶
func (info Scalar) LatestFloat64(measure *stats.Float64Measure) Handle
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 ¶
func (info Scalar) LatestInt64(measure *stats.Int64Measure) Handle
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 ¶
func (info Scalar) SumFloat64(measure *stats.Float64Measure) Handle
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.