metric

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interval

type Interval struct {
	OldestInclusive model.Time
	NewestInclusive model.Time
}

Interval describes the inclusive interval between two Timestamps.

type LabelMatcher

type LabelMatcher struct {
	Type  MatchType
	Name  model.LabelName
	Value model.LabelValue
	// contains filtered or unexported fields
}

LabelMatcher models the matching of a label. Create with NewLabelMatcher.

func NewLabelMatcher

func NewLabelMatcher(matchType MatchType, name model.LabelName, value model.LabelValue) (*LabelMatcher, error)

NewLabelMatcher returns a LabelMatcher object ready to use.

func (*LabelMatcher) Filter

Filter takes a list of label values and returns all label values which match the label matcher.

func (*LabelMatcher) Match

func (m *LabelMatcher) Match(v model.LabelValue) bool

Match returns true if the label matcher matches the supplied label value.

func (*LabelMatcher) MatchesEmptyString added in v1.1.0

func (m *LabelMatcher) MatchesEmptyString() bool

MatchesEmptyString returns true if the LabelMatcher matches the empty string.

func (*LabelMatcher) String

func (m *LabelMatcher) String() string

type LabelMatchers

type LabelMatchers []*LabelMatcher

LabelMatchers is a slice of LabelMatcher objects. By implementing the sort.Interface, it is sortable by cardinality score, i.e. after sorting, the LabelMatcher that is expected to yield the fewest matches is first in the slice, and LabelMatchers that match the empty string are last.

func (LabelMatchers) Len added in v1.1.0

func (lms LabelMatchers) Len() int

func (LabelMatchers) Less added in v1.1.0

func (lms LabelMatchers) Less(i, j int) bool

func (LabelMatchers) Swap added in v1.1.0

func (lms LabelMatchers) Swap(i, j int)

type MatchType

type MatchType int

MatchType is an enum for label matching types.

const (
	Equal MatchType = iota
	NotEqual
	RegexMatch
	RegexNoMatch
)

Possible MatchTypes.

func (MatchType) String

func (m MatchType) String() string

type Metric

type Metric struct {
	Copied bool
	Metric model.Metric
}

Metric wraps a model.Metric and copies it upon modification if Copied is false.

func (*Metric) Copy

func (m *Metric) Copy() *Metric

Copy the underlying Metric if it is not already a copy.

func (*Metric) Del

func (m *Metric) Del(ln model.LabelName)

Del deletes a given label name from the wrapped Metric and copies the Metric initially, if it is not already a copy.

func (*Metric) Get

func (m *Metric) Get(ln model.LabelName) model.LabelValue

Get the value for the given label name. An empty value is returned if the label does not exist in the metric.

func (*Metric) Gets

func (m *Metric) Gets(ln model.LabelName) (model.LabelValue, bool)

Gets behaves as Get but the returned boolean is false iff the label does not exist.

func (*Metric) Set

func (m *Metric) Set(ln model.LabelName, lv model.LabelValue)

Set sets a label name in the wrapped Metric to a given value and copies the Metric initially, if it is not already a copy.

func (Metric) String

func (m Metric) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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