diff --git a/go.mod b/go.mod index 23d75d1e1..0346cb428 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2-0.20190406162018-d3fcbee8e181 // indirect github.com/hashicorp/go-hclog v0.14.1 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect - github.com/hashicorp/go-retryablehttp v0.6.7 // indirect + github.com/hashicorp/go-retryablehttp v0.6.7 github.com/jmhodges/levigo v1.0.0 // indirect github.com/karriereat/blackfriday-slack v0.1.0 github.com/kr/text v0.2.0 // indirect diff --git a/metric_source/remote/remote.go b/metric_source/remote/remote.go index 6be143ecf..a860a1139 100644 --- a/metric_source/remote/remote.go +++ b/metric_source/remote/remote.go @@ -2,6 +2,7 @@ package remote import ( "fmt" + "github.com/hashicorp/go-retryablehttp" "net/http" "time" @@ -31,9 +32,14 @@ type Remote struct { // Create configures remote metric source func Create(config *Config) metricSource.MetricSource { + retryClient := retryablehttp.NewClient() + // Need add to config + retryClient.RetryMax = 3 + retryClient.RetryWaitMax = 60 * time.Second + return &Remote{ config: config, - client: &http.Client{Timeout: config.Timeout}, + client: retryClient.StandardClient(), } }