aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ondřej Benkovský <ondrej.benkovsky@jamf.com> 2022-09-12 22:35:59 +0200
committerGravatar GitHub <noreply@github.com> 2022-09-12 16:35:59 -0400
commitdc84196690ac74c4d735d5f3d3eb9980d7a7ffc6 (patch)
treeb18cae2ddd00bac0dc4f8f5549e810111309ddf9
parent8655b7cbc35bc2030b5f3db6d94bd9b5a94f87c3 (diff)
downloadcoredns-dc84196690ac74c4d735d5f3d3eb9980d7a7ffc6.tar.gz
coredns-dc84196690ac74c4d735d5f3d3eb9980d7a7ffc6.tar.zst
coredns-dc84196690ac74c4d735d5f3d3eb9980d7a7ffc6.zip
plugin/acl : add view label into metrics (#5615)
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com> Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
-rw-r--r--plugin/acl/README.md6
-rw-r--r--plugin/acl/acl.go6
-rw-r--r--plugin/acl/metrics.go6
3 files changed, 10 insertions, 8 deletions
diff --git a/plugin/acl/README.md b/plugin/acl/README.md
index 4b34500e4..6e5b827e1 100644
--- a/plugin/acl/README.md
+++ b/plugin/acl/README.md
@@ -89,8 +89,10 @@ example.org {
If monitoring is enabled (via the _prometheus_ plugin) then the following metrics are exported:
-- `coredns_acl_blocked_requests_total{server, zone}` - counter of DNS requests being blocked.
+- `coredns_acl_blocked_requests_total{server, zone, view}` - counter of DNS requests being blocked.
-- `coredns_acl_allowed_requests_total{server}` - counter of DNS requests being allowed.
+- `coredns_acl_filtered_requests_total{server, zone, view}` - counter of DNS requests being filtered.
+
+- `coredns_acl_allowed_requests_total{server, view}` - counter of DNS requests being allowed.
The `server` and `zone` labels are explained in the _metrics_ plugin documentation.
diff --git a/plugin/acl/acl.go b/plugin/acl/acl.go
index 017a8ac6b..7d7b9d600 100644
--- a/plugin/acl/acl.go
+++ b/plugin/acl/acl.go
@@ -75,7 +75,7 @@ RulesCheckLoop:
ede := dns.EDNS0_EDE{InfoCode: dns.ExtendedErrorCodeBlocked}
m.IsEdns0().Option = append(m.IsEdns0().Option, &ede)
w.WriteMsg(m)
- RequestBlockCount.WithLabelValues(metrics.WithServer(ctx), zone).Inc()
+ RequestBlockCount.WithLabelValues(metrics.WithServer(ctx), zone, metrics.WithView(ctx)).Inc()
return dns.RcodeSuccess, nil
}
case actionAllow:
@@ -90,13 +90,13 @@ RulesCheckLoop:
ede := dns.EDNS0_EDE{InfoCode: dns.ExtendedErrorCodeFiltered}
m.IsEdns0().Option = append(m.IsEdns0().Option, &ede)
w.WriteMsg(m)
- RequestFilterCount.WithLabelValues(metrics.WithServer(ctx), zone).Inc()
+ RequestFilterCount.WithLabelValues(metrics.WithServer(ctx), zone, metrics.WithView(ctx)).Inc()
return dns.RcodeSuccess, nil
}
}
}
- RequestAllowCount.WithLabelValues(metrics.WithServer(ctx)).Inc()
+ RequestAllowCount.WithLabelValues(metrics.WithServer(ctx), metrics.WithView(ctx)).Inc()
return plugin.NextOrFailure(state.Name(), a.Next, ctx, w, r)
}
diff --git a/plugin/acl/metrics.go b/plugin/acl/metrics.go
index 76f30b5a6..04d728bcd 100644
--- a/plugin/acl/metrics.go
+++ b/plugin/acl/metrics.go
@@ -14,19 +14,19 @@ var (
Subsystem: pluginName,
Name: "blocked_requests_total",
Help: "Counter of DNS requests being blocked.",
- }, []string{"server", "zone"})
+ }, []string{"server", "zone", "view"})
// RequestFilterCount is the number of DNS requests being filtered.
RequestFilterCount = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "filtered_requests_total",
Help: "Counter of DNS requests being filtered.",
- }, []string{"server", "zone"})
+ }, []string{"server", "zone", "view"})
// RequestAllowCount is the number of DNS requests being Allowed.
RequestAllowCount = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "allowed_requests_total",
Help: "Counter of DNS requests being allowed.",
- }, []string{"server"})
+ }, []string{"server", "view"})
)