metric

package
v0.0.0-...-30f5ca6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetRegistry

func SetRegistry(r Registry)

SetRegistry may be used to reset the global metric registry, which should not be needed unless for testing purposes.

Types

type Float64Entry

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

func (Float64Entry) Set

func (g Float64Entry) Set(ctx context.Context, val float64)

type Float64Gauge

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

func NewFloat64Gauge

func NewFloat64Gauge(name string, mos ...Option) *Float64Gauge

func (*Float64Gauge) DefinitionID

func (g *Float64Gauge) DefinitionID() core.EventID

func (*Float64Gauge) Err

func (bm *Float64Gauge) Err() error

func (*Float64Gauge) Fields

func (bm *Float64Gauge) Fields() []core.Key

func (*Float64Gauge) Gauge

func (g *Float64Gauge) Gauge(values ...core.KeyValue) Float64Entry

func (*Float64Gauge) Measure

func (bm *Float64Gauge) Measure() core.Measure

func (*Float64Gauge) Type

func (bm *Float64Gauge) Type() MetricType

type Metric

type Metric interface {
	Measure() core.Measure

	DefinitionID() core.EventID

	Type() MetricType
	Fields() []core.Key
	Err() error
	// contains filtered or unexported methods
}

type MetricType

type MetricType int
const (
	Invalid MetricType = iota
	GaugeInt64
	GaugeFloat64
	DerivedGaugeInt64
	DerivedGaugeFloat64
	CumulativeInt64
	CumulativeFloat64
	DerivedCumulativeInt64
	DerivedCumulativeFloat64
)

type Option

type Option func(*baseMetric, *[]tag.Option)

func WithDescription

func WithDescription(desc string) Option

WithDescription applies provided description.

func WithKeys

func WithKeys(keys ...core.Key) Option

WithKeys applies the provided dimension keys.

func WithUnit

func WithUnit(unit unit.Unit) Option

WithUnit applies provided unit.

type Registry

type Registry interface {
	RegisterMetric(Metric) (Metric, error)
	ForeachMetric(func(string, Metric))
}

Registry is a mechanism for avoiding duplicate registration of different-type pre-aggregated metrics (in one process).

func GetRegistry

func GetRegistry() Registry

GetRegistry may be used to access a global list of metric definitions.

Jump to

Keyboard shortcuts

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