introduce metric naming test (#3789)

* introduce metric naming test

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>

* Update metrics.go

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
Zou Nengren
2020-03-31 14:07:36 +08:00
committed by GitHub
parent 10d176b811
commit 87214a4c5c
18 changed files with 297 additions and 97 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
"github.com/prometheus/client_golang/prometheus"
)
// ServeDNS implements the plugin.Handler interface.
@@ -47,28 +46,5 @@ func (d Dnssec) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return plugin.NextOrFailure(d.Name(), d.Next, ctx, w, r)
}
var (
cacheSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_size",
Help: "The number of elements in the dnssec cache.",
}, []string{"server", "type"})
cacheHits = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_hits_total",
Help: "The count of cache hits.",
}, []string{"server"})
cacheMisses = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: "dnssec",
Name: "cache_misses_total",
Help: "The count of cache misses.",
}, []string{"server"})
)
// Name implements the Handler interface.
func (d Dnssec) Name() string { return "dnssec" }