mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Fix HTTP connection leak upon non-OK status.
Change-Id: Ie7fbd7dcc089b8306b40631be3e3d736c23c1cd3
This commit is contained in:
parent
144d5bb9fd
commit
1bb7074fec
|
@ -246,10 +246,10 @@ func (t *target) scrape(timestamp clientmodel.Timestamp, ingester extraction.Ing
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return fmt.Errorf("server returned HTTP status %s", resp.Status)
|
return fmt.Errorf("server returned HTTP status %s", resp.Status)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
processor, err := extraction.ProcessorForRequestHeader(resp.Header)
|
processor, err := extraction.ProcessorForRequestHeader(resp.Header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue