aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin.md2
-rw-r--r--plugin/acl/README.md4
-rw-r--r--plugin/acl/metrics.go8
-rw-r--r--plugin/acl/setup.go6
-rw-r--r--plugin/dns64/README.md11
-rw-r--r--plugin/dns64/metrics.go4
-rw-r--r--plugin/dns64/setup.go8
-rw-r--r--plugin/kubernetes/metrics.go6
-rw-r--r--plugin/kubernetes/setup.go10
9 files changed, 34 insertions, 25 deletions
diff --git a/plugin.md b/plugin.md
index dfb043c11..68ab10e50 100644
--- a/plugin.md
+++ b/plugin.md
@@ -56,7 +56,7 @@ server.
## Metrics
When exporting metrics the *Namespace* should be `plugin.Namespace` (="coredns"), and the
-*Subsystem* should be the name of the plugin. The README.md for the plugin should then also contain
+*Subsystem* must be the name of the plugin. The README.md for the plugin should then also contain
a *Metrics* section detailing the metrics.
## Readiness
diff --git a/plugin/acl/README.md b/plugin/acl/README.md
index fd08b406b..3c1e193ee 100644
--- a/plugin/acl/README.md
+++ b/plugin/acl/README.md
@@ -73,8 +73,8 @@ example.org {
If monitoring is enabled (via the _prometheus_ plugin) then the following metrics are exported:
-- `coredns_dns_blocked_requests_total{server, zone}` - counter of DNS requests being blocked.
+- `coredns_acl_blocked_requests_total{server, zone}` - counter of DNS requests being blocked.
-- `coredns_dns_allowed_requests_total{server}` - counter of DNS requests being allowed.
+- `coredns_acl_allowed_requests_total{server}` - counter of DNS requests being allowed.
The `server` and `zone` labels are explained in the _metrics_ plugin documentation.
diff --git a/plugin/acl/metrics.go b/plugin/acl/metrics.go
index 1f235b85b..719f24675 100644
--- a/plugin/acl/metrics.go
+++ b/plugin/acl/metrics.go
@@ -10,15 +10,15 @@ var (
// RequestBlockCount is the number of DNS requests being blocked.
RequestBlockCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
- Subsystem: "dns",
- Name: "acl_blocked_requests_total",
+ Subsystem: pluginName,
+ Name: "blocked_requests_total",
Help: "Counter of DNS requests being blocked.",
}, []string{"server", "zone"})
// RequestAllowCount is the number of DNS requests being Allowed.
RequestAllowCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
- Subsystem: "dns",
- Name: "acl_allowed_requests_total",
+ Subsystem: pluginName,
+ Name: "allowed_requests_total",
Help: "Counter of DNS requests being allowed.",
}, []string{"server"})
)
diff --git a/plugin/acl/setup.go b/plugin/acl/setup.go
index 749737714..1bc891b50 100644
--- a/plugin/acl/setup.go
+++ b/plugin/acl/setup.go
@@ -13,7 +13,9 @@ import (
"github.com/miekg/dns"
)
-func init() { plugin.Register("acl", setup) }
+const pluginName = "acl"
+
+func init() { plugin.Register(pluginName, setup) }
func newDefaultFilter() *iptree.Tree {
defaultFilter := iptree.NewTree()
@@ -27,7 +29,7 @@ func newDefaultFilter() *iptree.Tree {
func setup(c *caddy.Controller) error {
a, err := parse(c)
if err != nil {
- return plugin.Error("acl", err)
+ return plugin.Error(pluginName, err)
}
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
diff --git a/plugin/dns64/README.md b/plugin/dns64/README.md
index ef3d90867..6f3709336 100644
--- a/plugin/dns64/README.md
+++ b/plugin/dns64/README.md
@@ -6,8 +6,6 @@
## Description
-From Wikipedia:
-
> DNS64 describes a DNS server that when asked for a domain's AAAA records, but only finds
> A records, synthesizes the AAAA records from the A records.
@@ -56,6 +54,15 @@ dns64 {
* `prefix` specifies any local IPv6 prefix to use, instead of the well known prefix (64:ff9b::/96)
+
+## Metrics
+
+If monitoring is enabled (via the _prometheus_ plugin) then the following metrics are exported:
+
+- `coredns_dns64_requests_translated_total{server}` - counter of DNS requests translated
+
+The `server` label is explained in the _prometheus_ plugin documentation.
+
## Bugs
Not all features required by DNS64 are implemented, only basic AAAA synthesis.
diff --git a/plugin/dns64/metrics.go b/plugin/dns64/metrics.go
index 892455adb..7383c715e 100644
--- a/plugin/dns64/metrics.go
+++ b/plugin/dns64/metrics.go
@@ -10,8 +10,8 @@ var (
// RequestsTranslatedCount is the number of DNS requests translated by dns64.
RequestsTranslatedCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
- Subsystem: "dns",
- Name: "requests_dns64_translated_total",
+ Subsystem: pluginName,
+ Name: "requests_translated_total",
Help: "Counter of DNS requests translated by dns64.",
}, []string{"server"})
)
diff --git a/plugin/dns64/setup.go b/plugin/dns64/setup.go
index 7d1737229..bc87ac9df 100644
--- a/plugin/dns64/setup.go
+++ b/plugin/dns64/setup.go
@@ -12,14 +12,16 @@ import (
"github.com/caddyserver/caddy"
)
-var log = clog.NewWithPlugin("dns64")
+const pluginName = "dns64"
-func init() { plugin.Register("dns64", setup) }
+var log = clog.NewWithPlugin(pluginName)
+
+func init() { plugin.Register(pluginName, setup) }
func setup(c *caddy.Controller) error {
dns64, err := dns64Parse(c)
if err != nil {
- return plugin.Error("dns64", err)
+ return plugin.Error(pluginName, err)
}
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
diff --git a/plugin/kubernetes/metrics.go b/plugin/kubernetes/metrics.go
index 5547add89..7c6bfa1b0 100644
--- a/plugin/kubernetes/metrics.go
+++ b/plugin/kubernetes/metrics.go
@@ -9,10 +9,6 @@ import (
api "k8s.io/api/core/v1"
)
-const (
- subsystem = "kubernetes"
-)
-
var (
// DnsProgrammingLatency is defined as the time it took to program a DNS instance - from the time
// a service or pod has changed to the time the change was propagated and was available to be
@@ -27,7 +23,7 @@ var (
// * headless_without_selector
DnsProgrammingLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: plugin.Namespace,
- Subsystem: subsystem,
+ Subsystem: pluginName,
Name: "dns_programming_duration_seconds",
// From 1 millisecond to ~17 minutes.
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20),
diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go
index 0edde3bdb..2a58471d3 100644
--- a/plugin/kubernetes/setup.go
+++ b/plugin/kubernetes/setup.go
@@ -27,21 +27,23 @@ import (
"k8s.io/klog"
)
-var log = clog.NewWithPlugin("kubernetes")
+const pluginName = "kubernetes"
-func init() { plugin.Register("kubernetes", setup) }
+var log = clog.NewWithPlugin(pluginName)
+
+func init() { plugin.Register(pluginName, setup) }
func setup(c *caddy.Controller) error {
klog.SetOutput(os.Stdout)
k, err := kubernetesParse(c)
if err != nil {
- return plugin.Error("kubernetes", err)
+ return plugin.Error(pluginName, err)
}
err = k.InitKubeCache(context.Background())
if err != nil {
- return plugin.Error("kubernetes", err)
+ return plugin.Error(pluginName, err)
}
k.RegisterKubeCache(c)