export config file hash in a metric (#3768)

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
Zou Nengren 2020-03-25 21:33:04 +08:00 committed by GitHub
parent 1766568398
commit 1dba31ee7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View file

@ -7,6 +7,7 @@ import (
"time"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/metrics"
clog "github.com/coredns/coredns/plugin/pkg/log"
"github.com/caddyserver/caddy"
@ -67,11 +68,13 @@ func setup(c *caddy.Controller) error {
// prepare info for next onInstanceStartup event
r.setInterval(i)
r.setUsage(used)
once.Do(func() {
caddy.RegisterEventHook("reload", hook)
c.OnRestart(func() error {
metrics.MustRegister(c, reloadInfo)
return nil
})
})
// re-register on finalShutDown as the instance most-likely will be changed
shutOnce.Do(func() {
c.OnFinalShutdown(func() error {