mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
middleware/proxy: sane(r) metrics
Add proxy_proto and re-instate proto to be the protocol of the incoming
query ("tcp" or "udp").
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user