mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: release http response non-200 status code
This commit is contained in:
parent
1de1774de6
commit
b0a5c382ee
1 changed files with 1 additions and 1 deletions
|
@ -215,13 +215,13 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
|
||||||
} else if !swapResponseBodies {
|
} else if !swapResponseBodies {
|
||||||
dst = append(dst, resp.Body()...)
|
dst = append(dst, resp.Body()...)
|
||||||
}
|
}
|
||||||
|
fasthttp.ReleaseResponse(resp)
|
||||||
if statusCode != fasthttp.StatusOK {
|
if statusCode != fasthttp.StatusOK {
|
||||||
metrics.GetOrCreateCounter(fmt.Sprintf(`vm_promscrape_scrapes_total{status_code="%d"}`, statusCode)).Inc()
|
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",
|
return dst, fmt.Errorf("unexpected status code returned when scraping %q: %d; expecting %d; response body: %q",
|
||||||
c.scrapeURL, statusCode, fasthttp.StatusOK, dst)
|
c.scrapeURL, statusCode, fasthttp.StatusOK, dst)
|
||||||
}
|
}
|
||||||
scrapesOK.Inc()
|
scrapesOK.Inc()
|
||||||
fasthttp.ReleaseResponse(resp)
|
|
||||||
return dst, nil
|
return dst, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue