using promauto package to ensure all created metrics are properly registered (#4025)

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
Zou Nengren 2020-07-25 23:06:28 +08:00 committed by GitHub
parent 05751bdb59
commit 4166dcc2fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 71 additions and 163 deletions

View file

@ -4,25 +4,26 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
// cacheSize is the number of elements in the dnssec cache.
cacheSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{
cacheSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_entries",
Help: "The number of elements in the dnssec cache.",
}, []string{"server", "type"})
// cacheHits is the count of cache hits.
cacheHits = prometheus.NewCounterVec(prometheus.CounterOpts{
cacheHits = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_hits_total",
Help: "The count of cache hits.",
}, []string{"server"})
// cacheMisses is the count of cache misses.
cacheMisses = prometheus.NewCounterVec(prometheus.CounterOpts{
cacheMisses = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_misses_total",