Use new function
This commit is contained in:
parent
ae199bcc5c
commit
c217c891ff
10
setup.go
10
setup.go
@ -32,15 +32,7 @@ func setup(c *caddy.Controller) error {
|
|||||||
// prometheus plugin has been used - if so we will export metrics. We can only register
|
// prometheus plugin has been used - if so we will export metrics. We can only register
|
||||||
// this metric once, hence the "once.Do".
|
// this metric once, hence the "once.Do".
|
||||||
c.OnStartup(func() error {
|
c.OnStartup(func() error {
|
||||||
once.Do(func() {
|
once.Do(func() { metrics.MustRegister(c, requestCount) })
|
||||||
m := dnsserver.GetConfig(c).Handler("prometheus")
|
|
||||||
if m == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if x, ok := m.(*metrics.Metrics); ok {
|
|
||||||
x.MustRegister(requestCount)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user