Skip to content

Commit

Permalink
Add response_header_timeout
Browse files Browse the repository at this point in the history
Add ability to set timeout on downstream separate from dial

Fixes #501
  • Loading branch information
jacksontj committed Mar 28, 2022
1 parent 2c2b15b commit 9b8a803
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/promxy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions pkg/servergroup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/servergroup/servergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 9b8a803

Please sign in to comment.