GetIngestersForMetadata returns a replication set including all ingesters that should be queried to fetch metadata (eg. label names/values or series).
(ctx context.Context)
| 114 | // GetIngestersForMetadata returns a replication set including all ingesters that should be queried |
| 115 | // to fetch metadata (eg. label names/values or series). |
| 116 | func (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. |
no test coverage detected