diff options
Diffstat (limited to 'plugin/dnssec/setup.go')
-rw-r--r-- | plugin/dnssec/setup.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugin/dnssec/setup.go b/plugin/dnssec/setup.go index 012ba5b3d..26cdbe2f1 100644 --- a/plugin/dnssec/setup.go +++ b/plugin/dnssec/setup.go @@ -7,6 +7,7 @@ import ( "github.com/coredns/coredns/core/dnsserver" "github.com/coredns/coredns/plugin" + "github.com/coredns/coredns/plugin/metrics" "github.com/coredns/coredns/plugin/pkg/cache" "github.com/mholt/caddy" @@ -30,6 +31,22 @@ func setup(c *caddy.Controller) error { return New(zones, keys, next, ca) }) + c.OnStartup(func() error { + once.Do(func() { + m := dnsserver.GetConfig(c).Handler("prometheus") + if m == nil { + return + } + if x, ok := m.(*metrics.Metrics); ok { + x.MustRegister(cacheSize) + x.MustRegister(cacheCapacity) + x.MustRegister(cacheHits) + x.MustRegister(cacheMisses) + } + }) + return nil + }) + // Export the capacity for the metrics. This only happens once, because this is a re-load change only. cacheCapacity.WithLabelValues("signature").Set(float64(capacity)) |