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

Method LabelNames

pkg/distributor/distributor.go:1494–1508  ·  view source on GitHub ↗

LabelNames returns all the label names.

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

Source from the content-addressed store, hash-verified

1492
1493// LabelNames returns all the label names.
1494func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error) {
1495 return d.LabelNamesCommon(ctx, from, to, hint, func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest, queryLimiter *limiter.QueryLimiter) ([]any, error) {
1496 return d.ForReplicationSet(ctx, rs, d.cfg.ZoneResultsQuorumMetadata, partialDataEnabled, func(ctx context.Context, client ingester_client.IngesterClient) (any, error) {
1497 resp, err := client.LabelNames(ctx, req)
1498 if err != nil {
1499 return nil, err
1500 }
1501 if err := queryLimiter.AddDataBytes(resp.Size()); err != nil {
1502 return nil, validation.LimitError(err.Error())
1503 }
1504
1505 return resp.LabelNames, nil
1506 })
1507 }, matchers...)
1508}
1509
1510// MetricsForLabelMatchers gets the metrics that match said matchers
1511func (d *Distributor) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, hint *storage.SelectHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]labels.Labels, error) {

Callers

nothing calls this directly

Calls 7

LabelNamesCommonMethod · 0.95
ForReplicationSetMethod · 0.95
LimitErrorTypeAlias · 0.92
AddDataBytesMethod · 0.80
LabelNamesMethod · 0.65
SizeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected