mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Set timeout for marathon_sd
This commit is contained in:
parent
c689b35858
commit
2bc12fa2fb
|
@ -124,6 +124,7 @@ var (
|
||||||
|
|
||||||
// DefaultMarathonSDConfig is the default Marathon SD configuration.
|
// DefaultMarathonSDConfig is the default Marathon SD configuration.
|
||||||
DefaultMarathonSDConfig = MarathonSDConfig{
|
DefaultMarathonSDConfig = MarathonSDConfig{
|
||||||
|
Timeout: model.Duration(30 * time.Second),
|
||||||
RefreshInterval: model.Duration(30 * time.Second),
|
RefreshInterval: model.Duration(30 * time.Second),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,6 +777,7 @@ func (c *NerveSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
// MarathonSDConfig is the configuration for services running on Marathon.
|
// MarathonSDConfig is the configuration for services running on Marathon.
|
||||||
type MarathonSDConfig struct {
|
type MarathonSDConfig struct {
|
||||||
Servers []string `yaml:"servers,omitempty"`
|
Servers []string `yaml:"servers,omitempty"`
|
||||||
|
Timeout model.Duration `yaml:"timeout,omitempty"`
|
||||||
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
|
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
|
||||||
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
|
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,7 @@ var expectedConf = &Config{
|
||||||
Servers: []string{
|
Servers: []string{
|
||||||
"https://marathon.example.com:443",
|
"https://marathon.example.com:443",
|
||||||
},
|
},
|
||||||
|
Timeout: model.Duration(30 * time.Second),
|
||||||
RefreshInterval: model.Duration(30 * time.Second),
|
RefreshInterval: model.Duration(30 * time.Second),
|
||||||
TLSConfig: TLSConfig{
|
TLSConfig: TLSConfig{
|
||||||
CertFile: "testdata/valid_cert_file",
|
CertFile: "testdata/valid_cert_file",
|
||||||
|
|
|
@ -87,6 +87,7 @@ func NewDiscovery(conf *config.MarathonSDConfig) (*Discovery, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
|
Timeout: time.Duration(conf.Timeout),
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
TLSClientConfig: tls,
|
TLSClientConfig: tls,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue