diff options
Diffstat (limited to 'plugin/proxy/proxy.go')
-rw-r--r-- | plugin/proxy/proxy.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/plugin/proxy/proxy.go b/plugin/proxy/proxy.go index b2c713a53..f0e6eadad 100644 --- a/plugin/proxy/proxy.go +++ b/plugin/proxy/proxy.go @@ -80,9 +80,6 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( for time.Since(start) < tryDuration { host := upstream.Select() if host == nil { - - RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) - return dns.RcodeServerFailure, fmt.Errorf("%s: %s", errUnreachable, "no upstream host") } @@ -94,6 +91,8 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( atomic.AddInt64(&host.Conns, 1) queryEpoch := msg.Epoch() + RequestCount.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Add(1) + reply, backendErr = upstream.Exchanger().Exchange(ctx, host.Name, state) respEpoch := msg.Epoch() @@ -108,7 +107,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( if backendErr == nil { w.WriteMsg(reply) - RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) + RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Observe(float64(time.Since(start) / time.Millisecond)) return 0, taperr } @@ -139,8 +138,6 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( }(host, timeout) } - RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) - return dns.RcodeServerFailure, fmt.Errorf("%s: %s", errUnreachable, backendErr) } } |