mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
Adds blocks drop (#1151)
* adds blocks drop at 400 BadRequest status code recieved from remote storage, not expected that remote storage will be able to handle it on retry * removes error logging for dropped blocks, its expected error
This commit is contained in:
parent
f39c84b21f
commit
1b7dc1e5a5
1 changed files with 5 additions and 4 deletions
|
@ -259,13 +259,14 @@ again:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
metrics.GetOrCreateCounter(fmt.Sprintf(`vmagent_remotewrite_requests_total{url=%q, status_code="%d"}`, c.sanitizedURL, statusCode)).Inc()
|
metrics.GetOrCreateCounter(fmt.Sprintf(`vmagent_remotewrite_requests_total{url=%q, status_code="%d"}`, c.sanitizedURL, statusCode)).Inc()
|
||||||
if statusCode == 409 {
|
if statusCode == 409 || statusCode == 400 {
|
||||||
// Just drop block on 409 status code like Prometheus does.
|
// Just drop block on 409 status code like Prometheus does.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/873
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/873
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
// drop block on 400 status code,
|
||||||
|
// not expected that remote server will be able to handle it on retry
|
||||||
|
// should fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1149
|
||||||
|
_, _ = ioutil.ReadAll(resp.Body)
|
||||||
_ = resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
logger.Errorf("unexpected status code received when sending a block with size %d bytes to %q: #%d; dropping the block like Prometheus does; "+
|
|
||||||
"response body=%q", len(block), c.sanitizedURL, statusCode, body)
|
|
||||||
c.packetsDropped.Inc()
|
c.packetsDropped.Inc()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue