MCPcopy
hub / github.com/prometheus/prometheus / LabelValues

Method LabelValues

tsdb/head_read.go:87–97  ·  view source on GitHub ↗

LabelValues returns label values present in the head for the specific label name that are within the time range mint to maxt. If matchers are specified the returned result set is reduced to label values of metrics matching the matchers.

(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

85// If matchers are specified the returned result set is reduced
86// to label values of metrics matching the matchers.
87func (h *headIndexReader) LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) {
88 if h.maxt < h.head.MinTime() || h.mint > h.head.MaxTime() {
89 return []string{}, nil
90 }
91
92 if len(matchers) == 0 {
93 return h.head.postings.LabelValues(ctx, name, hints), nil
94 }
95
96 return labelValuesWithMatchers(ctx, h, name, hints, matchers...)
97}
98
99// LabelNames returns all the unique label names present in the head
100// that are within the time range mint to maxt.

Callers 1

SortedLabelValuesMethod · 0.95

Calls 4

labelValuesWithMatchersFunction · 0.85
LabelValuesMethod · 0.65
MinTimeMethod · 0.45
MaxTimeMethod · 0.45

Tested by

no test coverage detected