middleware/monitoring: add more monitoring (#182)
* Split response size into normal responses and AXFR|IXFR responses. * Split out incoming sizes as well in normal and AXFR|IXFRs. * Add meta qtype to the monitored qtypes. * Make duration to be exported in milliseconds instead of seconds.
This commit is contained in:
parent
d277f21d39
commit
d563c62571
3 changed files with 66 additions and 30 deletions
|
@ -42,20 +42,29 @@ func Report(state middleware.State, zone, rcode string, size int, start time.Tim
|
|||
fam = "2"
|
||||
}
|
||||
|
||||
typ := state.QType()
|
||||
|
||||
requestCount.WithLabelValues(zone, net, fam).Inc()
|
||||
requestDuration.WithLabelValues(zone).Observe(float64(time.Since(start) / time.Second))
|
||||
requestSize.WithLabelValues(zone, net).Observe(float64(state.Size()))
|
||||
requestDuration.WithLabelValues(zone).Observe(float64(time.Since(start) / time.Millisecond))
|
||||
|
||||
if state.Do() {
|
||||
requestDo.WithLabelValues(zone).Inc()
|
||||
}
|
||||
typ := state.QType()
|
||||
|
||||
if _, known := monitorType[typ]; known {
|
||||
requestType.WithLabelValues(zone, dns.Type(typ).String()).Inc()
|
||||
} else {
|
||||
requestType.WithLabelValues(zone, other).Inc()
|
||||
}
|
||||
|
||||
responseSize.WithLabelValues(zone, net).Observe(float64(size))
|
||||
if typ == dns.TypeIXFR || typ == dns.TypeAXFR {
|
||||
responseTransferSize.WithLabelValues(zone, net).Observe(float64(size))
|
||||
requestTransferSize.WithLabelValues(zone, net).Observe(float64(size))
|
||||
} else {
|
||||
responseSize.WithLabelValues(zone, net).Observe(float64(size))
|
||||
requestSize.WithLabelValues(zone, net).Observe(float64(state.Size()))
|
||||
}
|
||||
|
||||
responseRcode.WithLabelValues(zone, rcode).Inc()
|
||||
}
|
||||
|
||||
|
@ -74,6 +83,10 @@ var monitorType = map[uint16]bool{
|
|||
dns.TypeSOA: true,
|
||||
dns.TypeSRV: true,
|
||||
dns.TypeTXT: true,
|
||||
// Meta Qtypes
|
||||
dns.TypeIXFR: true,
|
||||
dns.TypeAXFR: true,
|
||||
dns.TypeANY: true,
|
||||
}
|
||||
|
||||
const other = "other"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue