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

Function shardByAllLabels

pkg/distributor/distributor.go:591–600  ·  view source on GitHub ↗

This function generates different values for different order of same labels.

(userID string, labels []cortexpb.LabelAdapter)

Source from the content-addressed store, hash-verified

589
590// This function generates different values for different order of same labels.
591func shardByAllLabels(userID string, labels []cortexpb.LabelAdapter) uint32 {
592 h := shardByUser(userID)
593 for _, label := range labels {
594 if len(label.Value) > 0 {
595 h = ingester_client.HashAdd32(h, label.Name)
596 h = ingester_client.HashAdd32(h, label.Value)
597 }
598 }
599 return h
600}
601
602// Remove the label labelname from a slice of LabelPairs if it exists.
603func removeLabel(labelName string, labels *[]cortexpb.LabelAdapter) {

Callers 3

PushMethod · 0.85
tokenForLabelsMethod · 0.85

Calls 1

shardByUserFunction · 0.85

Tested by 2

PushMethod · 0.68