diff --git a/docs/sources/configuration/_index.md b/docs/sources/configuration/_index.md index 718524ff639e..4670ed9b49a5 100644 --- a/docs/sources/configuration/_index.md +++ b/docs/sources/configuration/_index.md @@ -1006,6 +1006,11 @@ lifecycler: # CLI flag: -distributor.replication-factor [replication_factor: | default = 3] + # True to enable the zone-awareness and replicate ingested samples across + # different availability zones. + # CLI flag: -distributor.zone-awareness-enabled + [zone_awareness_enabled: | default = false] + # The number of tokens the lifecycler will generate and put into the ring if # it joined without transferring tokens from another lifecycler. # CLI flag: -ingester.num-tokens @@ -1035,6 +1040,10 @@ lifecycler: # CLI flag: -ingester.final-sleep [final_sleep: | default = 0s] + # The availability zone where this instance is running. + # CLI flag: -ingester.availability-zone + [availability_zone: | default = ""] + # Number of times to try and transfer chunks when leaving before # falling back to flushing to the store. Zero = no transfers are done. # CLI flag: -ingester.max-transfer-retries diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 1cfa7cb890c1..a898490b9f7e 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -275,13 +275,15 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log return nil, httpgrpc.Errorf(http.StatusTooManyRequests, validation.RateLimitedErrorMsg, int(d.ingestionRateLimiter.Limit(now, userID)), validatedSamplesCount, validatedSamplesSize) } - const maxExpectedReplicationSet = 5 // typical replication factor 3 plus one for inactive plus one for luck - var descs [maxExpectedReplicationSet]ring.InstanceDesc - + var ( + bufDescs [ring.GetBufferSize]ring.InstanceDesc + bufHosts [ring.GetBufferSize]string + bufZones [ring.GetBufferSize]string + ) samplesByIngester := map[string][]*streamTracker{} ingesterDescs := map[string]ring.InstanceDesc{} for i, key := range keys { - replicationSet, err := d.ingestersRing.Get(key, ring.Write, descs[:0], nil, nil) + replicationSet, err := d.ingestersRing.Get(key, ring.Write, bufDescs[:0], bufHosts[:0], bufZones[:0]) if err != nil { return nil, err }