mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
fixes panic at scrape error body formating, (#868)
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/864 regression after body reuse improvements
This commit is contained in:
parent
058f49de57
commit
e8fe618bbb
1 changed files with 1 additions and 2 deletions
|
@ -196,7 +196,6 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
|
|||
}
|
||||
return dst, fmt.Errorf("error when scraping %q: %w", c.scrapeURL, err)
|
||||
}
|
||||
dstLen := len(dst)
|
||||
if ce := resp.Header.Peek("Content-Encoding"); string(ce) == "gzip" {
|
||||
var err error
|
||||
var src []byte
|
||||
|
@ -219,7 +218,7 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
|
|||
if statusCode != fasthttp.StatusOK {
|
||||
metrics.GetOrCreateCounter(fmt.Sprintf(`vm_promscrape_scrapes_total{status_code="%d"}`, statusCode)).Inc()
|
||||
return dst, fmt.Errorf("unexpected status code returned when scraping %q: %d; expecting %d; response body: %q",
|
||||
c.scrapeURL, statusCode, fasthttp.StatusOK, dst[dstLen:])
|
||||
c.scrapeURL, statusCode, fasthttp.StatusOK, dst)
|
||||
}
|
||||
scrapesOK.Inc()
|
||||
fasthttp.ReleaseResponse(resp)
|
||||
|
|
Loading…
Reference in a new issue