aboutsummaryrefslogtreecommitdiff
path: root/middleware/metrics/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/metrics/handler.go')
-rw-r--r--middleware/metrics/handler.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/middleware/metrics/handler.go b/middleware/metrics/handler.go
index 019a02c3e..6b0401378 100644
--- a/middleware/metrics/handler.go
+++ b/middleware/metrics/handler.go
@@ -48,7 +48,32 @@ func Report(state middleware.State, zone, rcode string, size int, start time.Tim
if state.Do() {
requestDo.WithLabelValues(zone).Inc()
}
+ typ := state.QType()
+ if _, known := monitorType[typ]; known {
+ requestType.WithLabelValues(zone, dns.Type(typ).String())
+ } else {
+ requestType.WithLabelValues(zone, other)
+ }
responseSize.WithLabelValues(zone, net).Observe(float64(size))
responseRcode.WithLabelValues(zone, rcode).Inc()
}
+
+var monitorType = map[uint16]bool{
+ dns.TypeAAAA: true,
+ dns.TypeA: true,
+ dns.TypeCNAME: true,
+ dns.TypeDNSKEY: true,
+ dns.TypeDS: true,
+ dns.TypeMX: true,
+ dns.TypeNSEC3: true,
+ dns.TypeNSEC: true,
+ dns.TypeNS: true,
+ dns.TypePTR: true,
+ dns.TypeRRSIG: true,
+ dns.TypeSOA: true,
+ dns.TypeSRV: true,
+ dns.TypeTXT: true,
+}
+
+const other = "other"