mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 12:30:46 +01:00
Log response body if test fails.
This commit is contained in:
parent
190d1347ba
commit
4d294889da
@ -93,11 +93,15 @@ func queryExporter(address string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
b, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := resp.Body.Close(); err != nil {
|
if err := resp.Body.Close(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if want, have := http.StatusOK, resp.StatusCode; want != have {
|
if want, have := http.StatusOK, resp.StatusCode; want != have {
|
||||||
return fmt.Errorf("want /metrics status code %d, have %d", want, have)
|
return fmt.Errorf("want /metrics status code %d, have %d. Body:\n%s", want, have, b)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user