diff --git a/cmd/promxy/config.yaml b/cmd/promxy/config.yaml index 75fd2308a..0e074ec5d 100644 --- a/cmd/promxy/config.yaml +++ b/cmd/promxy/config.yaml @@ -60,6 +60,9 @@ promxy: # dial_timeout controls how long promxy will wait for a connection to the downstream # the default is 200ms. dial_timeout: 1s + # response_header_timeout controls how long promxy will wait for headers from a downstream + # this does not include the time required to read the response body + response_header_timeout: 10s tls_config: insecure_skip_verify: true diff --git a/pkg/servergroup/config.go b/pkg/servergroup/config.go index 8c8827553..c934d528b 100644 --- a/pkg/servergroup/config.go +++ b/pkg/servergroup/config.go @@ -154,8 +154,9 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error { // HTTPClientConfig extends prometheus' HTTPClientConfig type HTTPClientConfig struct { - DialTimeout time.Duration `yaml:"dial_timeout"` - HTTPConfig config_util.HTTPClientConfig `yaml:",inline"` + DialTimeout time.Duration `yaml:"dial_timeout"` + ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout"` + HTTPConfig config_util.HTTPClientConfig `yaml:",inline"` } // RelativeTimeRangeConfig configures durations relative from "now" to define diff --git a/pkg/servergroup/servergroup.go b/pkg/servergroup/servergroup.go index 1b5339b5d..98fdae428 100644 --- a/pkg/servergroup/servergroup.go +++ b/pkg/servergroup/servergroup.go @@ -270,6 +270,7 @@ func (s *ServerGroup) ApplyConfig(cfg *Config) error { // 5 minutes is typically above the maximum sane scrape interval. So we can // use keepalive for all configurations. IdleConnTimeout: 5 * time.Minute, + ResponseHeaderTimeout: cfg.HTTPConfig.ResponseHeaderTimeout, DialContext: (&net.Dialer{Timeout: cfg.HTTPConfig.DialTimeout}).DialContext, ResponseHeaderTimeout: cfg.Timeout, }