MCPcopy Index your code
hub / github.com/cortexproject/cortex / GetIngestersForMetadata

Method GetIngestersForMetadata

pkg/distributor/query.go:116–134  ·  view source on GitHub ↗

GetIngestersForMetadata returns a replication set including all ingesters that should be queried to fetch metadata (eg. label names/values or series).

(ctx context.Context)

Source from the content-addressed store, hash-verified

114// GetIngestersForMetadata returns a replication set including all ingesters that should be queried
115// to fetch metadata (eg. label names/values or series).
116func (d *Distributor) GetIngestersForMetadata(ctx context.Context) (ring.ReplicationSet, error) {
117 userID, err := users.TenantID(ctx)
118 if err != nil {
119 return ring.ReplicationSet{}, err
120 }
121
122 // If shuffle sharding is enabled we should only query ingesters which are
123 // part of the tenant's subring.
124 if d.cfg.ShardingStrategy == util.ShardingStrategyShuffle {
125 shardSize := d.limits.IngestionTenantShardSize(userID)
126 lookbackPeriod := d.cfg.ShuffleShardingLookbackPeriod
127
128 if shardSize > 0 && lookbackPeriod > 0 {
129 return d.ingestersRing.ShuffleShardWithLookback(userID, shardSize, lookbackPeriod, time.Now()).GetReplicationSetForOperation(ring.Read)
130 }
131 }
132
133 return d.ingestersRing.GetReplicationSetForOperation(ring.Read)
134}
135
136// mergeExemplarSets merges and dedupes two sets of already sorted exemplar pairs.
137// Both a and b should be lists of exemplars from the same series.

Callers 5

LabelNamesCommonMethod · 0.95
MetricsMetadataMethod · 0.95
UserStatsMethod · 0.95

Calls 4

TenantIDFunction · 0.92

Tested by

no test coverage detected