From fa0abe747327b7dda0b2566f45dcea649f26fb0b Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 7 Feb 2017 21:28:47 +0000 Subject: middleware/proxy: sane(r) metrics Add proxy_proto and re-instate proto to be the protocol of the incoming query ("tcp" or "udp"). --- middleware/proxy/proxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'middleware/proxy/proxy.go') diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go index b8b50adc6..1a595d99e 100644 --- a/middleware/proxy/proxy.go +++ b/middleware/proxy/proxy.go @@ -93,7 +93,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( host := upstream.Select() if host == nil { - RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return dns.RcodeServerFailure, errUnreachable } @@ -116,7 +116,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( if backendErr == nil { w.WriteMsg(reply) - RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return 0, nil } @@ -131,7 +131,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( }(host, timeout) } - RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) return dns.RcodeServerFailure, errUnreachable } -- cgit v1.2.3