package lv

import "github.com/go-kit/kit/metrics/internal/lv"

Index

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.

Source Files

labelvalues.go space.go

Version
v0.13.0 (latest)
Published
May 29, 2023
Platform
linux/amd64
Imports
1 packages
Last checked
10 hours ago

Tools for package owners.