metric

package
v0.0.0-...-a58bcba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package metric aggregates events into metrics that can be exported.

Index

Constants

This section is empty.

Variables

View Source
var Entries = keys.New("metric_entries", "The set of metrics calculated for an event")

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func (*Config) Exporter

func (e *Config) Exporter(output event.Exporter) event.Exporter

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.

func (HistogramFloat64) Record

func (info HistogramFloat64) Record(e *Config, key *keys.Float64)

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 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.

func (HistogramInt64) Record

func (info HistogramInt64) Record(e *Config, key *keys.Int64)

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 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.

func (*Int64Data) Groups

func (data *Int64Data) Groups() [][]label.Label

func (*Int64Data) Handle

func (data *Int64Data) Handle() string

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

func (info Scalar) Count(e *Config, key label.Key)

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

func (info Scalar) LatestFloat64(e *Config, key *keys.Float64)

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(e *Config, key *keys.Int64)

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(e *Config, key *keys.Float64)

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.

func (Scalar) SumInt64

func (info Scalar) SumInt64(e *Config, key *keys.Int64)

SumInt64 creates a new metric based on the Scalar information that sums all the values recorded on the int64 measure. Metrics of this type will use Int64Data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL