aboutsummaryrefslogtreecommitdiff
path: root/plugin/autopath/metrics.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/autopath/metrics.go')
-rw-r--r--plugin/autopath/metrics.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugin/autopath/metrics.go b/plugin/autopath/metrics.go
new file mode 100644
index 000000000..3901fde3a
--- /dev/null
+++ b/plugin/autopath/metrics.go
@@ -0,0 +1,29 @@
+package autopath
+
+import (
+ "sync"
+
+ "github.com/coredns/coredns/plugin"
+
+ "github.com/prometheus/client_golang/prometheus"
+)
+
+// Metrics for autopath.
+var (
+ AutoPathCount = prometheus.NewCounterVec(prometheus.CounterOpts{
+ Namespace: plugin.Namespace,
+ Subsystem: "autopath",
+ Name: "success_count_total",
+ Help: "Counter of requests that did autopath.",
+ }, []string{})
+)
+
+// OnStartupMetrics sets up the metrics on startup.
+func OnStartupMetrics() error {
+ metricsOnce.Do(func() {
+ prometheus.MustRegister(AutoPathCount)
+ })
+ return nil
+}
+
+var metricsOnce sync.Once