mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	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>
This commit is contained in:
		| @@ -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. | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user