mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
* Update Caddy to 1.0.1, and update import path This fix updates caddy to 1.0.1 and also updates the import path to github.com/caddyserver/caddy This fix fixes 2959 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Also update plugin.cfg Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update and bump zplugin.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
24 lines
483 B
Go
24 lines
483 B
Go
package metrics
|
|
|
|
import (
|
|
"github.com/coredns/coredns/core/dnsserver"
|
|
|
|
"github.com/caddyserver/caddy"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
// MustRegister registers the prometheus Collectors when the metrics plugin is used.
|
|
func MustRegister(c *caddy.Controller, cs ...prometheus.Collector) {
|
|
m := dnsserver.GetConfig(c).Handler("prometheus")
|
|
if m == nil {
|
|
return
|
|
}
|
|
x, ok := m.(*Metrics)
|
|
if !ok {
|
|
return
|
|
}
|
|
for _, c := range cs {
|
|
x.MustRegister(c)
|
|
}
|
|
}
|