projects
/
blackbox_exporter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
349a556
)
Ensure duration of lookup is set if ip resolution fails (#180)
author
Conor Broderick
<conor.broderick@robustperception.io>
Tue, 4 Jul 2017 11:53:41 +0000
(12:53 +0100)
committer
Brian Brazil
<brian.brazil@robustperception.io>
Tue, 4 Jul 2017 11:53:41 +0000
(12:53 +0100)
utils.go
patch
|
blob
|
blame
|
history
diff --git
a/utils.go
b/utils.go
index c885c7f3a2602ddfe953f9c7e582936bddf543eb..1828a4fb4eb3e249c6b4a113fc5686f75a40d1db 100644
(file)
--- a/
utils.go
+++ b/
utils.go
@@
-39,6
+39,8
@@
func chooseProtocol(preferredIPProtocol string, target string, registry *prometh
resolveStart := time.Now()
+ defer probeDNSLookupTimeSeconds.Add(time.Since(resolveStart).Seconds())
+
ip, err := net.ResolveIPAddr(preferredIPProtocol, target)
if err != nil {
ip, err = net.ResolveIPAddr(fallbackProtocol, target)
@@
-47,8
+49,6
@@
func chooseProtocol(preferredIPProtocol string, target string, registry *prometh
}
}
- probeDNSLookupTimeSeconds.Add(time.Since(resolveStart).Seconds())
-
if ip.IP.To4() == nil {
probeIPProtocolGauge.Set(6)
} else {