lib/promscrape: always initialize http client for stream parsing mode

Stream parsing mode can be automatically enabled when scraping targets with big response bodies
exceeding the -promscrape.minResponseSizeForStreamParse , so it must be always initialized.
This commit is contained in:
Aliaksandr Valialkin 2021-10-16 13:18:20 +03:00
parent 0f4fda1bda
commit 99011c6b63
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -106,7 +106,6 @@ func newClient(sw *ScrapeWork) *client {
MaxIdempotentRequestAttempts: 1, MaxIdempotentRequestAttempts: 1,
} }
var sc *http.Client var sc *http.Client
if *streamParse || sw.StreamParse {
var proxyURLFunc func(*http.Request) (*url.URL, error) var proxyURLFunc func(*http.Request) (*url.URL, error)
if proxyURL := sw.ProxyURL.URL(); proxyURL != nil { if proxyURL := sw.ProxyURL.URL(); proxyURL != nil {
proxyURLFunc = http.ProxyURL(proxyURL) proxyURLFunc = http.ProxyURL(proxyURL)
@ -138,7 +137,6 @@ func newClient(sw *ScrapeWork) *client {
return http.ErrUseLastResponse return http.ErrUseLastResponse
} }
} }
}
return &client{ return &client{
hc: hc, hc: hc,
sc: sc, sc: sc,