aboutsummaryrefslogtreecommitdiff
path: root/plugin/hosts/setup.go
diff options
context:
space:
mode:
authorGravatar yeya24 <yb532204897@gmail.com> 2019-09-19 11:38:15 -0400
committerGravatar Miek Gieben <miek@miek.nl> 2019-09-19 16:38:15 +0100
commit85e65702bd5b02c0ced5be51e02860c5ae9321aa (patch)
treeae86c5990190150201b56564fe8209a5b8607704 /plugin/hosts/setup.go
parent62317c3c14e306e337f7aa0507a2245495c7aed2 (diff)
downloadcoredns-85e65702bd5b02c0ced5be51e02860c5ae9321aa.tar.gz
coredns-85e65702bd5b02c0ced5be51e02860c5ae9321aa.tar.zst
coredns-85e65702bd5b02c0ced5be51e02860c5ae9321aa.zip
add host metrics (#3277)
* add host metrics Signed-off-by: yeya24 <yb532204897@gmail.com> * update hosts readme docs Signed-off-by: yeya24 <yb532204897@gmail.com>
Diffstat (limited to 'plugin/hosts/setup.go')
-rw-r--r--plugin/hosts/setup.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/hosts/setup.go b/plugin/hosts/setup.go
index 981ea141f..be95a547f 100644
--- a/plugin/hosts/setup.go
+++ b/plugin/hosts/setup.go
@@ -9,6 +9,7 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
+ "github.com/coredns/coredns/plugin/metrics"
clog "github.com/coredns/coredns/plugin/pkg/log"
"github.com/caddyserver/caddy"
@@ -57,6 +58,12 @@ func setup(c *caddy.Controller) error {
return nil
})
+ c.OnStartup(func() error {
+ metrics.MustRegister(c, hostsEntries)
+ metrics.MustRegister(c, hostsReloadTime)
+ return nil
+ })
+
c.OnShutdown(func() error {
close(parseChan)
return nil