Skip to content

Commit

Permalink
http prober: DNS lookup for proxy if proxy_url is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Vekshin committed Jul 2, 2018
1 parent 4b4594d commit 11d5fe9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions prober/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,19 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr
}
durationGaugeVec.WithLabelValues("resolve").Add(lookupTime)
if targetPort == "" {
targetURL.Host = "[" + ip.String() + "]"
targetURL.Host = "[" + ip.String() + "]"
} else {
targetURL.Host = net.JoinHostPort(ip.String(), targetPort)
targetURL.Host = net.JoinHostPort(ip.String(), targetPort)
}
}

} else {
proxyHost := httpClientConfig.ProxyURL.URL.Host
_, lookupTime, err := chooseProtocol(module.HTTP.PreferredIPProtocol, proxyHost, registry, logger)
if err != nil {
level.Error(logger).Log("msg", "Error resolving proxy address", "err", err)
return false
}
durationGaugeVec.WithLabelValues("resolve").Add(lookupTime)
}

client, err := pconfig.NewHTTPClientFromConfig(&httpClientConfig)
if err != nil {
Expand Down

0 comments on commit 11d5fe9

Please sign in to comment.