lib/promscrape: mention about -promscrape.maxScrapeSize in the error message when target returns too big response

This commit is contained in:
Aliaksandr Valialkin 2020-05-24 14:41:08 +03:00
parent fbdce0c6ac
commit b747362936

View File

@ -96,6 +96,10 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
scrapesTimedout.Inc() scrapesTimedout.Inc()
return dst, fmt.Errorf("error when scraping %q with timeout %s: %s", c.scrapeURL, c.hc.ReadTimeout, err) return dst, fmt.Errorf("error when scraping %q with timeout %s: %s", c.scrapeURL, c.hc.ReadTimeout, err)
} }
if err == fasthttp.ErrBodyTooLarge {
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)
}
return dst, fmt.Errorf("error when scraping %q: %s", c.scrapeURL, err) return dst, fmt.Errorf("error when scraping %q: %s", c.scrapeURL, err)
} }
dstLen := len(dst) dstLen := len(dst)