Dont log per qtype - fun and all, but not really useful

This commit is contained in:
Miek Gieben
2016-04-09 17:42:31 +01:00
parent 12b304d981
commit 49f994fa80
4 changed files with 16 additions and 16 deletions

View File

@@ -12,7 +12,7 @@ import (
func (m Metrics) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
state := middleware.State{W: w, Req: r}
qname := state.Name()
qtype := state.Type()
net := state.Proto()
zone := middleware.Zones(m.ZoneNames).Matches(qname)
if zone == "" {
zone = "."
@@ -22,21 +22,21 @@ func (m Metrics) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
rw := middleware.NewResponseRecorder(w)
status, err := m.Next.ServeDNS(ctx, rw, r)
Report(zone, qtype, rw.Rcode(), rw.Size(), rw.Start())
Report(zone, net, rw.Rcode(), rw.Size(), rw.Start())
return status, err
}
// Report is a plain reporting function that the server can use for REFUSED and other
// queries that are turned down because they don't match any middleware.
func Report(zone, qtype, rcode string, size int, start time.Time) {
func Report(zone, net, rcode string, size int, start time.Time) {
if requestCount == nil {
// no metrics are enabled
return
}
requestCount.WithLabelValues(zone, qtype).Inc()
requestDuration.WithLabelValues(zone, qtype).Observe(float64(time.Since(start) / time.Second))
responseSize.WithLabelValues(zone, qtype).Observe(float64(size))
responseRcode.WithLabelValues(zone, rcode, qtype).Inc()
requestCount.WithLabelValues(zone, net).Inc()
requestDuration.WithLabelValues(zone).Observe(float64(time.Since(start) / time.Second))
responseSize.WithLabelValues(zone).Observe(float64(size))
responseRcode.WithLabelValues(zone, rcode).Inc()
}