提交 9516d044 编写于 作者: F Fabian Reinartz

util: Add idle timeout for scrape connections

上级 3bee3627
......@@ -420,6 +420,7 @@ func (s *targetScraper) scrape(ctx context.Context, w io.Writer) error {
s.req = req
}
resp, err := ctxhttp.Do(ctx, s.client, s.req)
if err != nil {
return err
......
......@@ -47,6 +47,9 @@ func NewClientFromConfig(cfg config.HTTPClientConfig) (*http.Client, error) {
DisableKeepAlives: false,
TLSClientConfig: tlsConfig,
DisableCompression: true,
// 5 minutes is typically above the maximum sane scrape interval. So we can
// use keepalive for all configurations.
IdleConnTimeout: 5 * time.Minute,
}
// If a bearer token is provided, create a round tripper that will set the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册