mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmagent/remotewrite: drop packets only on 409 status code, since there are other valid 4xx status codes, which shouldnt result in packet drop
This commit is contained in:
parent
1b9778a756
commit
887a3c317f
1 changed files with 3 additions and 3 deletions
|
@ -231,12 +231,12 @@ again:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
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/100 == 4 {
|
if statusCode == 409 {
|
||||||
// Just drop block on 4xx 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)
|
body, _ := 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 for 4XX status code like Prometheus does; "+
|
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)
|
"response body=%q", len(block), c.sanitizedURL, statusCode, body)
|
||||||
c.packetsDropped.Inc()
|
c.packetsDropped.Inc()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue