Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
func (m *LabelMatcher) Filter(in model.LabelValues) model.LabelValues
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) String ¶ added in v1.7.0
func (lms LabelMatchers) String() string
func (LabelMatchers) Swap ¶ added in v1.1.0
func (lms LabelMatchers) Swap(i, j int)
type Metric ¶
Metric wraps a model.Metric and copies it upon modification if Copied is false.
func (*Metric) Del ¶
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 ¶
Gets behaves as Get but the returned boolean is false iff the label does not exist.