mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
plugin/autopath: Add metrics and remove log line (#1143)
* plugin/autopath: Add namespace selector and metrics Add a namespace, so autopathing only is performed in this namespace. This will make caching work for the cluster again. Also export metrics that we've done a successful autopath * dont shadow * Fix * Back the namespacing changes
This commit is contained in:
29
plugin/autopath/metrics.go
Normal file
29
plugin/autopath/metrics.go
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user