mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
fix(promscrape): check MaxScrapeSize after gzip decompression (#3550)
This commit is contained in:
parent
ae0a77d778
commit
04d536c15a
1 changed files with 5 additions and 0 deletions
|
@ -322,6 +322,11 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
|
|||
} else if !swapResponseBodies {
|
||||
dst = append(dst, resp.Body()...)
|
||||
}
|
||||
if len(dst) > c.hc.MaxResponseBodySize {
|
||||
maxScrapeSizeExceeded.Inc()
|
||||
return dst, fmt.Errorf("the response from %q exceeds -promscrape.maxScrapeSize=%d; "+
|
||||
"either reduce the response size for the target or increase -promscrape.maxScrapeSize", c.scrapeURL, maxScrapeSize.N)
|
||||
}
|
||||
fasthttp.ReleaseResponse(resp)
|
||||
if statusCode != fasthttp.StatusOK {
|
||||
metrics.GetOrCreateCounter(fmt.Sprintf(`vm_promscrape_scrapes_total{status_code="%d"}`, statusCode)).Inc()
|
||||
|
|
Loading…
Reference in a new issue