Metrics (#1579)
* plugin/metrics: set server address in context Allow cross server block metrics to co-exist; for this we should label each metric with the server label. Put this information in the context and provide a helper function to get it out. Abstracting with entirely away with difficult as the release client_go (0.8.0) doesn't have the CurryWith functions yet. So current use is like so: define metric, with server label: RcodeCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: "forward", Name: "response_rcode_count_total", Help: "Counter of requests made per upstream.", }, []string{"server", "rcode", "to"}) And report ith with the helper function metrics.WithServer: RcodeCount.WithLabelValues(metrics.WithServer(ctx), rc, p.addr).Add(1)
This commit is contained in:
parent
5c5a98ee29
commit
4df416ca1d
4 changed files with 43 additions and 7 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/coredns/coredns/coremain"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
"github.com/coredns/coredns/plugin/metrics/vars"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue