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

Method tokenForLabels

pkg/distributor/distributor.go:556–566  ·  view source on GitHub ↗
(userID string, labels []cortexpb.LabelAdapter)

Source from the content-addressed store, hash-verified

554}
555
556func (d *Distributor) tokenForLabels(userID string, labels []cortexpb.LabelAdapter) (uint32, error) {
557 if d.cfg.ShardByAllLabels {
558 return shardByAllLabels(userID, labels), nil
559 }
560
561 unsafeMetricName, err := extract.UnsafeMetricNameFromLabelAdapters(labels)
562 if err != nil {
563 return 0, err
564 }
565 return shardByMetricName(userID, unsafeMetricName), nil
566}
567
568func (d *Distributor) tokenForMetadata(userID string, metricName string) uint32 {
569 if d.cfg.ShardByAllLabels {

Callers 1

prepareSeriesKeysMethod · 0.95

Calls 3

shardByAllLabelsFunction · 0.85
shardByMetricNameFunction · 0.85

Tested by

no test coverage detected