DigitalOcean: limit refresh timeout (#7425)

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2020-06-20 09:45:28 +02:00 committed by GitHub
parent 74207c0465
commit fb9a1a872e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ var DefaultSDConfig = SDConfig{
type SDConfig struct { type SDConfig struct {
HTTPClientConfig config_util.HTTPClientConfig `yaml:",inline"` HTTPClientConfig config_util.HTTPClientConfig `yaml:",inline"`
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` RefreshInterval model.Duration `yaml:"refresh_interval"`
Port int `yaml:"port"` Port int `yaml:"port"`
} }
@ -95,7 +95,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) {
d.client, err = godo.New( d.client, err = godo.New(
&http.Client{ &http.Client{
Transport: rt, Transport: rt,
Timeout: 5 * time.Duration(conf.RefreshInterval), Timeout: time.Duration(conf.RefreshInterval),
}, },
godo.SetUserAgent(fmt.Sprintf("Prometheus/%s", version.Version)), godo.SetUserAgent(fmt.Sprintf("Prometheus/%s", version.Version)),
) )