mirror of
https://github.com/coredns/coredns.git
synced 2025-11-13 15:32:24 -05:00
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 ..
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package autopath
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/coredns/coredns/plugin"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
@@ -16,5 +14,3 @@ var (
|
||||
Help: "Counter of requests that did autopath.",
|
||||
}, []string{"server"})
|
||||
)
|
||||
|
||||
var once sync.Once
|
||||
|
||||
@@ -26,7 +26,7 @@ func setup(c *caddy.Controller) error {
|
||||
}
|
||||
|
||||
c.OnStartup(func() error {
|
||||
once.Do(func() { metrics.MustRegister(c, autoPathCount) })
|
||||
metrics.MustRegister(c, autoPathCount)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user