Browse Source

Use new function

Miek Gieben 7 years ago
parent
commit
c217c891ff
1 changed files with 1 additions and 9 deletions
  1. 1 9
      setup.go

+ 1 - 9
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
 	// this metric once, hence the "once.Do".
 	c.OnStartup(func() error {
-		once.Do(func() {
-			m := dnsserver.GetConfig(c).Handler("prometheus")
-			if m == nil {
-				return
-			}
-			if x, ok := m.(*metrics.Metrics); ok {
-				x.MustRegister(requestCount)
-			}
-		})
+		once.Do(func() { metrics.MustRegister(c, requestCount) })
 		return nil
 	})