lv

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LabelValues

type LabelValues []string

LabelValues is a type alias that provides validation on its With method. Metrics may include it as a member to help them satisfy With semantics and save some code duplication.

func (LabelValues) With

func (lvs LabelValues) With(labelValues ...string) LabelValues

With validates the input, and returns a new aggregate labelValues.

type Space

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

Space represents an N-dimensional vector space. Each name and unique label value pair establishes a new dimension and point within that dimension. Order matters, i.e. [a=1 b=2] identifies a different timeseries than [b=2 a=1].

func NewSpace

func NewSpace() *Space

NewSpace returns an N-dimensional vector space.

func (*Space) Add

func (s *Space) Add(name string, lvs LabelValues, delta float64)

Add locates the time series identified by the name and label values in the vector space, and appends the delta to the last value in the list of observations.

func (*Space) Observe

func (s *Space) Observe(name string, lvs LabelValues, value float64)

Observe locates the time series identified by the name and label values in the vector space, and appends the value to the list of observations.

func (*Space) Reset

func (s *Space) Reset() *Space

Reset empties the current space and returns a new Space with the old contents. Reset a Space to get an immutable copy suitable for walking.

func (*Space) Walk

func (s *Space) Walk(fn func(name string, lvs LabelValues, observations []float64) bool)

Walk traverses the vector space and invokes fn for each non-empty time series which is encountered. Return false to abort the traversal.

Jump to

Keyboard shortcuts

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