mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
remote-write: respect Retry-After header on 5xx errors
If the server sent it to us, we should assume it knows better than we do and respect it. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
c173cd57c9
commit
9b85354acd
|
@ -236,10 +236,8 @@ func (c *Client) Store(ctx context.Context, req []byte, attempt int) error {
|
|||
}
|
||||
err = fmt.Errorf("server returned HTTP status %s: %s", httpResp.Status, line)
|
||||
}
|
||||
if httpResp.StatusCode/100 == 5 {
|
||||
return RecoverableError{err, defaultBackoff}
|
||||
}
|
||||
if c.retryOnRateLimit && httpResp.StatusCode == http.StatusTooManyRequests {
|
||||
if httpResp.StatusCode/100 == 5 ||
|
||||
(c.retryOnRateLimit && httpResp.StatusCode == http.StatusTooManyRequests) {
|
||||
return RecoverableError{err, retryAfterDuration(httpResp.Header.Get("Retry-After"))}
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue