mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
export config file hash in a metric (#3768)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user