diff options
author | 2016-07-04 06:08:45 -0400 | |
---|---|---|
committer | 2016-07-04 06:08:45 -0400 | |
commit | d563c62571995ba4211b39a6ee3a29f5e3ec680e (patch) | |
tree | 2b0b8d363447c0ae77603f25ecddb55ed9f41f02 /middleware/metrics/handler.go | |
parent | d277f21d39ca7faca63d2ab652c8d8311b15f940 (diff) | |
download | coredns-d563c62571995ba4211b39a6ee3a29f5e3ec680e.tar.gz coredns-d563c62571995ba4211b39a6ee3a29f5e3ec680e.tar.zst coredns-d563c62571995ba4211b39a6ee3a29f5e3ec680e.zip |
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.
Diffstat (limited to 'middleware/metrics/handler.go')
-rw-r--r-- | middleware/metrics/handler.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/middleware/metrics/handler.go b/middleware/metrics/handler.go index 1a0acbe14..93d2654ab 100644 --- a/middleware/metrics/handler.go +++ b/middleware/metrics/handler.go @@ -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" |