Update comments

- updates comments and adds where missing
- updates locks so that unlock is done via defer instead of
at the end of the statement
- extracts timeout variable in two places
- remove makeClient() unused method from metrics package

No-harm changes tested via go build.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2018-10-03 13:16:28 +01:00
parent 609ef28cad
commit bd39b9267a
9 changed files with 40 additions and 34 deletions

View File

@ -60,11 +60,14 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
func (e *Exporter) StartServiceWatcher(endpointURL url.URL, metricsOptions MetricOptions, label string, interval time.Duration) {
ticker := time.NewTicker(interval)
quit := make(chan struct{})
timeout := 3 * time.Second
proxyClient := http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 3 * time.Second,
Timeout: timeout,
KeepAlive: 0,
}).DialContext,
MaxIdleConns: 1,