diff options
author | 2017-01-23 15:30:21 +0000 | |
---|---|---|
committer | 2017-01-23 15:30:21 +0000 | |
commit | 299360fe016590291fa1c0a6ea0db8ec800a2f90 (patch) | |
tree | 570e6ed82dea325e3ca62233de3cfc0f7e25fd7e | |
parent | c68dc7c1aabba825e850b614c10506586448058d (diff) | |
download | coredns-299360fe016590291fa1c0a6ea0db8ec800a2f90.tar.gz coredns-299360fe016590291fa1c0a6ea0db8ec800a2f90.tar.zst coredns-299360fe016590291fa1c0a6ea0db8ec800a2f90.zip |
Fix panic caused by missing metric labels in proxy. (#492)
-rw-r--r-- | middleware/proxy/proxy.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go index d1fde90e3..c30521210 100644 --- a/middleware/proxy/proxy.go +++ b/middleware/proxy/proxy.go @@ -80,7 +80,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( host := upstream.Select() if host == nil { - RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return dns.RcodeServerFailure, errUnreachable } @@ -94,7 +94,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( if backendErr == nil { w.WriteMsg(reply) - RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return 0, nil } @@ -109,7 +109,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( }(host, timeout) } - RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return dns.RcodeServerFailure, errUnreachable } |