lib/promscrape: properly log the actual response size after c4229a1bba

This commit is contained in:
Aliaksandr Valialkin 2023-01-23 21:04:50 -08:00
parent 903b2e710c
commit 95d4db0506
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -324,7 +324,7 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
if len(dst) > c.hc.MaxResponseBodySize {
maxScrapeSizeExceeded.Inc()
return dst, fmt.Errorf("the response from %q exceeds -promscrape.maxScrapeSize=%d (the actual response size is %d bytes); "+
"either reduce the response size for the target or increase -promscrape.maxScrapeSize", c.scrapeURL, len(dst), maxScrapeSize.N)
"either reduce the response size for the target or increase -promscrape.maxScrapeSize", c.scrapeURL, maxScrapeSize.N, len(dst))
}
if statusCode != fasthttp.StatusOK {
metrics.GetOrCreateCounter(fmt.Sprintf(`vm_promscrape_scrapes_total{status_code="%d"}`, statusCode)).Inc()