plugin/dnssec: add per server metrics (#1743)

* plugin/dnssec: add per server metrics

final plugin.

Fixes #1696 #1492 #1189

* Move cache cap into handler so we can access the server label

* Remove cache-capacity from it entirely
This commit is contained in:
Miek Gieben
2018-04-27 19:37:31 +01:00
committed by GitHub
parent 2a28efa877
commit 85f549b529
11 changed files with 55 additions and 52 deletions

View File

@@ -12,7 +12,8 @@ import (
// ResponseWriter sign the response on the fly.
type ResponseWriter struct {
dns.ResponseWriter
d Dnssec
d Dnssec
server string // server label for metrics.
}
// WriteMsg implements the dns.ResponseWriter interface.
@@ -28,9 +29,9 @@ func (d *ResponseWriter) WriteMsg(res *dns.Msg) error {
state.Zone = zone
if state.Do() {
res = d.d.Sign(state, time.Now().UTC())
res = d.d.Sign(state, time.Now().UTC(), d.server)
cacheSize.WithLabelValues("signature").Set(float64(d.d.cache.Len()))
cacheSize.WithLabelValues(d.server, "signature").Set(float64(d.d.cache.Len()))
}
state.SizeAndDo(res)