diff options
author | 2018-09-19 05:11:24 -0400 | |
---|---|---|
committer | 2018-09-19 02:11:24 -0700 | |
commit | f9bdd382ddf911c88b33d2bbd8f8aa9be2885a39 (patch) | |
tree | 13a8d3829b2c3560938619df65985fa33c966f41 /plugin/template/metrics.go | |
parent | cb932ca23103485d67e447eeddd855007015d30e (diff) | |
download | coredns-f9bdd382ddf911c88b33d2bbd8f8aa9be2885a39.tar.gz coredns-f9bdd382ddf911c88b33d2bbd8f8aa9be2885a39.tar.zst coredns-f9bdd382ddf911c88b33d2bbd8f8aa9be2885a39.zip |
Ensure Re-register of metrics variables after a reload (#2080)
* - ensure plugins that use prometheus.MustRegister, re-register after reload
- removing once.Do on the startup function was simplest way to do it.
* - fix underscored names (advice of bot)
* - tune existing UT for reload, and add a test verifying failing reload does not prevent correct registering for metrics
* - ensure different ports for tests that can run in same time ..
Diffstat (limited to 'plugin/template/metrics.go')
-rw-r--r-- | plugin/template/metrics.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/plugin/template/metrics.go b/plugin/template/metrics.go index 25474fc6c..d5fe0a4d7 100644 --- a/plugin/template/metrics.go +++ b/plugin/template/metrics.go @@ -1,8 +1,6 @@ package template import ( - "sync" - "github.com/coredns/coredns/plugin" "github.com/coredns/coredns/plugin/metrics" @@ -34,13 +32,9 @@ var ( // OnStartupMetrics sets up the metrics on startup. func setupMetrics(c *caddy.Controller) error { c.OnStartup(func() error { - metricsOnce.Do(func() { - metrics.MustRegister(c, templateMatchesCount, templateFailureCount, templateRRFailureCount) - }) + metrics.MustRegister(c, templateMatchesCount, templateFailureCount, templateRRFailureCount) return nil }) return nil } - -var metricsOnce sync.Once |