MCPcopy Create free account
hub / github.com/cortexproject/cortex / LabelValues

Method LabelValues

pkg/querier/distributor_queryable.go:239–263  ·  view source on GitHub ↗
(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

237}
238
239func (q *distributorQuerier) LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
240 var (
241 lvs []string
242 err error
243 )
244
245 partialDataEnabled := q.partialDataEnabled(ctx)
246
247 if q.streamingMetadata {
248 lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
249 return q.distributor.LabelValuesForLabelNameStream(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
250 })
251 } else {
252 lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
253 return q.distributor.LabelValuesForLabelName(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
254 })
255 }
256
257 if partialdata.IsPartialDataError(err) {
258 warnings := annotations.Annotations(nil)
259 return lvs, warnings.Add(err), nil
260 }
261
262 return lvs, nil, err
263}
264
265func (q *distributorQuerier) LabelNames(ctx context.Context, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
266 partialDataEnabled := q.partialDataEnabled(ctx)

Callers

nothing calls this directly

Calls 6

partialDataEnabledMethod · 0.95
labelsWithRetryMethod · 0.95
IsPartialDataErrorFunction · 0.92
AddMethod · 0.45

Tested by

no test coverage detected