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

Method LabelValuesForLabelName

pkg/distributor/distributor.go:1379–1392  ·  view source on GitHub ↗

LabelValuesForLabelName returns all the label values that are associated with a given label name.

(ctx context.Context, from, to model.Time, labelName model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

1377
1378// LabelValuesForLabelName returns all the label values that are associated with a given label name.
1379func (d *Distributor) LabelValuesForLabelName(ctx context.Context, from, to model.Time, labelName model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error) {
1380 return d.LabelValuesForLabelNameCommon(ctx, from, to, labelName, hint, func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelValuesRequest, queryLimiter *limiter.QueryLimiter) ([]any, error) {
1381 return d.ForReplicationSet(ctx, rs, d.cfg.ZoneResultsQuorumMetadata, partialDataEnabled, func(ctx context.Context, client ingester_client.IngesterClient) (any, error) {
1382 resp, err := client.LabelValues(ctx, req)
1383 if err != nil {
1384 return nil, err
1385 }
1386 if err := queryLimiter.AddDataBytes(resp.Size()); err != nil {
1387 return nil, validation.LimitError(err.Error())
1388 }
1389 return resp.LabelValues, nil
1390 })
1391 }, matchers...)
1392}
1393
1394// LabelValuesForLabelNameStream returns all the label values that are associated with a given label name.
1395func (d *Distributor) LabelValuesForLabelNameStream(ctx context.Context, from, to model.Time, labelName model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error) {

Callers

nothing calls this directly

Calls 7

ForReplicationSetMethod · 0.95
LimitErrorTypeAlias · 0.92
AddDataBytesMethod · 0.80
LabelValuesMethod · 0.65
SizeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected