diff options
author | 2017-12-13 16:59:10 -0500 | |
---|---|---|
committer | 2017-12-13 16:59:10 -0500 | |
commit | 1919913c986b7c1e1652a94bf69e54b503e40a18 (patch) | |
tree | 51ef8c36d4894736c920ac2151693b9a49c49708 /plugin/metrics/setup.go | |
parent | 2e2e5e1bec11e4dc5a7862443a34965b65332e73 (diff) | |
download | coredns-1919913c986b7c1e1652a94bf69e54b503e40a18.tar.gz coredns-1919913c986b7c1e1652a94bf69e54b503e40a18.tar.zst coredns-1919913c986b7c1e1652a94bf69e54b503e40a18.zip |
plugin/metrics: Added New func (#1309)
If external plugins wanted to extend metrics there was no way since
zoneNames couldn't be initialized. Now plugins can call New to get an
instance of Metrics that they can extend.
Diffstat (limited to 'plugin/metrics/setup.go')
-rw-r--r-- | plugin/metrics/setup.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/plugin/metrics/setup.go b/plugin/metrics/setup.go index eecfac62c..a0f68a53f 100644 --- a/plugin/metrics/setup.go +++ b/plugin/metrics/setup.go @@ -42,10 +42,7 @@ func setup(c *caddy.Controller) error { } func prometheusParse(c *caddy.Controller) (*Metrics, error) { - var ( - met = &Metrics{Addr: addr, zoneMap: make(map[string]bool)} - err error - ) + var met = New(defaultAddr) defer func() { uniqAddr.SetAddress(met.Addr) @@ -73,7 +70,7 @@ func prometheusParse(c *caddy.Controller) (*Metrics, error) { return met, c.ArgErr() } } - return met, err + return met, nil } var uniqAddr addrs @@ -91,8 +88,8 @@ func (a *addrs) SetAddress(addr string) { a.a[addr] = todo } -// Addr is the address the where the metrics are exported by default. -const addr = "localhost:9153" +// defaultAddr is the address the where the metrics are exported by default. +const defaultAddr = "localhost:9153" const ( todo = 1 |