diff options
author | 2022-09-14 20:45:45 +0200 | |
---|---|---|
committer | 2022-09-14 14:45:45 -0400 | |
commit | 4116a4ebdb0caae743cc9ebe0b462a0055c12754 (patch) | |
tree | 5d6f261026abe69ddeeb48990df4ed9a8eab908e /plugin | |
parent | 8138ab57dcd381ead5ddfc0f1019a88a62e5797b (diff) | |
download | coredns-4116a4ebdb0caae743cc9ebe0b462a0055c12754.tar.gz coredns-4116a4ebdb0caae743cc9ebe0b462a0055c12754.tar.zst coredns-4116a4ebdb0caae743cc9ebe0b462a0055c12754.zip |
plugin/prometheuss : make plugin enabled metric view aware (#5618)
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/metrics/README.md | 2 | ||||
-rw-r--r-- | plugin/metrics/setup.go | 4 | ||||
-rw-r--r-- | plugin/metrics/vars/vars.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/plugin/metrics/README.md b/plugin/metrics/README.md index e5c3b2bda..ec5da10d0 100644 --- a/plugin/metrics/README.md +++ b/plugin/metrics/README.md @@ -21,7 +21,7 @@ the following metrics are exported: * `coredns_dns_response_size_bytes{server, zone, view, proto}` - response size in bytes. * `coredns_dns_responses_total{server, zone, view, rcode, plugin}` - response per zone, rcode and plugin. * `coredns_dns_https_responses_total{server, status}` - responses per server and http status code. -* `coredns_plugin_enabled{server, zone, name}` - indicates whether a plugin is enabled on per server and zone basis. +* `coredns_plugin_enabled{server, zone, view, name}` - indicates whether a plugin is enabled on per server, zone and view basis. Almost each counter has a label `zone` which is the zonename used for the request/response. diff --git a/plugin/metrics/setup.go b/plugin/metrics/setup.go index 5ac7d8f7f..bee7d1f49 100644 --- a/plugin/metrics/setup.go +++ b/plugin/metrics/setup.go @@ -39,7 +39,7 @@ func setup(c *caddy.Controller) error { for _, h := range conf.ListenHosts { addrstr := conf.Transport + "://" + net.JoinHostPort(h, conf.Port) for _, p := range conf.Handlers() { - vars.PluginEnabled.WithLabelValues(addrstr, conf.Zone, p.Name()).Set(1) + vars.PluginEnabled.WithLabelValues(addrstr, conf.Zone, conf.ViewName, p.Name()).Set(1) } } return nil @@ -49,7 +49,7 @@ func setup(c *caddy.Controller) error { for _, h := range conf.ListenHosts { addrstr := conf.Transport + "://" + net.JoinHostPort(h, conf.Port) for _, p := range conf.Handlers() { - vars.PluginEnabled.WithLabelValues(addrstr, conf.Zone, p.Name()).Set(1) + vars.PluginEnabled.WithLabelValues(addrstr, conf.Zone, conf.ViewName, p.Name()).Set(1) } } return nil diff --git a/plugin/metrics/vars/vars.go b/plugin/metrics/vars/vars.go index f4ed76bae..f0cf829c9 100644 --- a/plugin/metrics/vars/vars.go +++ b/plugin/metrics/vars/vars.go @@ -64,7 +64,7 @@ var ( Namespace: plugin.Namespace, Name: "plugin_enabled", Help: "A metric that indicates whether a plugin is enabled on per server and zone basis.", - }, []string{"server", "zone", "name"}) + }, []string{"server", "zone", "view", "name"}) HTTPSResponsesCount = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, |