diff options
author | 2020-03-25 21:33:04 +0800 | |
---|---|---|
committer | 2020-03-25 14:33:04 +0100 | |
commit | 1dba31ee7d7ea5d4d02f3f2f519f25e5c9a3c379 (patch) | |
tree | bea207cbd0e67ec288f1a09c969aa484dabef46c /plugin/reload/setup.go | |
parent | 1766568398e3120c85d44f5c6237a724248b652e (diff) | |
download | coredns-1dba31ee7d7ea5d4d02f3f2f519f25e5c9a3c379.tar.gz coredns-1dba31ee7d7ea5d4d02f3f2f519f25e5c9a3c379.tar.zst coredns-1dba31ee7d7ea5d4d02f3f2f519f25e5c9a3c379.zip |
export config file hash in a metric (#3768)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
Diffstat (limited to 'plugin/reload/setup.go')
-rw-r--r-- | plugin/reload/setup.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugin/reload/setup.go b/plugin/reload/setup.go index c0dcc14e9..b0ba3e1c4 100644 --- a/plugin/reload/setup.go +++ b/plugin/reload/setup.go @@ -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 { |