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

Method LabelNamesStream

pkg/distributor/distributor.go:1465–1491  ·  view source on GitHub ↗
(ctx context.Context, from, to model.Time, hints *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

1463}
1464
1465func (d *Distributor) LabelNamesStream(ctx context.Context, from, to model.Time, hints *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error) {
1466 return d.LabelNamesCommon(ctx, from, to, hints, func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest, queryLimiter *limiter.QueryLimiter) ([]any, error) {
1467 return d.ForReplicationSet(ctx, rs, d.cfg.ZoneResultsQuorumMetadata, partialDataEnabled, func(ctx context.Context, client ingester_client.IngesterClient) (any, error) {
1468 stream, err := client.LabelNamesStream(ctx, req)
1469 if err != nil {
1470 return nil, err
1471 }
1472 defer stream.CloseSend() //nolint:errcheck
1473 allLabelNames := []string{}
1474 for {
1475 resp, err := stream.Recv()
1476 if err == io.EOF {
1477 break
1478 } else if err != nil {
1479 return nil, err
1480 }
1481 if err := queryLimiter.AddDataBytes(resp.Size()); err != nil {
1482 return nil, validation.LimitError(err.Error())
1483 }
1484
1485 allLabelNames = append(allLabelNames, resp.LabelNames...)
1486 }
1487
1488 return allLabelNames, nil
1489 })
1490 }, matchers...)
1491}
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) {

Callers

nothing calls this directly

Calls 9

LabelNamesCommonMethod · 0.95
ForReplicationSetMethod · 0.95
LimitErrorTypeAlias · 0.92
AddDataBytesMethod · 0.80
LabelNamesStreamMethod · 0.65
RecvMethod · 0.65
SizeMethod · 0.65
CloseSendMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected