Remote Write: Close connection after 3 retries

I propose a change in remote write. If we error out for > 3 times, then
we close the connection.

This is to htlp with user that are using load balancers and DNS, where
the active connection might point to a wrong DNS entry but the load
balancer of the old entry is still active, replying 503.

Signed-off-by: Julien <roidelapluie@o11y.eu>
This commit is contained in:
Julien 2024-10-22 10:41:52 +02:00
parent ad4857de52
commit 03fc1567f4

View file

@ -271,6 +271,7 @@ func (c *Client) Store(ctx context.Context, req []byte, attempt int) (WriteRespo
if attempt > 0 { if attempt > 0 {
httpReq.Header.Set("Retry-Attempt", strconv.Itoa(attempt)) httpReq.Header.Set("Retry-Attempt", strconv.Itoa(attempt))
httpReq.Close = attempt > 3
} }
ctx, cancel := context.WithTimeout(ctx, c.timeout) ctx, cancel := context.WithTimeout(ctx, c.timeout)