coredns plugin -- on server reload, metrics disappeared, therefore they must be registered on each reload instead of once
This commit is contained in:
parent
c143e3d57f
commit
876854d403
|
@ -187,10 +187,9 @@ func setup(c *caddy.Controller) error {
|
|||
})
|
||||
|
||||
c.OnStartup(func() error {
|
||||
onceMetrics.Do(func() {
|
||||
m := dnsserver.GetConfig(c).Handler("prometheus")
|
||||
if m == nil {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
if x, ok := m.(*metrics.Metrics); ok {
|
||||
x.MustRegister(requests)
|
||||
|
@ -203,7 +202,6 @@ func setup(c *caddy.Controller) error {
|
|||
x.MustRegister(errorsTotal)
|
||||
x.MustRegister(d)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
})
|
||||
c.OnShutdown(d.OnShutdown)
|
||||
|
@ -508,4 +506,4 @@ func (d *Plugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
|
|||
|
||||
func (d *Plugin) Name() string { return "dnsfilter" }
|
||||
|
||||
var onceMetrics, onceQueryLog sync.Once
|
||||
var onceQueryLog sync.Once
|
||||
|
|
Loading…
Reference in New Issue