mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-25 06:25:44 +03:00
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
1 changed files with 16 additions and 18 deletions
|
@ -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 a new issue