aboutsummaryrefslogtreecommitdiff
path: root/plugin/metrics/metrics.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-04-01 13:57:03 +0100
committerGravatar GitHub <noreply@github.com> 2018-04-01 13:57:03 +0100
commit4df416ca1da2fff396ff84805518aa8f8b55b80b (patch)
tree2ed84dce69a0a6565505aa1ad9dab5d8f4c58a75 /plugin/metrics/metrics.go
parent5c5a98ee292e68cf59faf66f601fdcb169ea7eed (diff)
downloadcoredns-4df416ca1da2fff396ff84805518aa8f8b55b80b.tar.gz
coredns-4df416ca1da2fff396ff84805518aa8f8b55b80b.tar.zst
coredns-4df416ca1da2fff396ff84805518aa8f8b55b80b.zip
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)
Diffstat (limited to 'plugin/metrics/metrics.go')
-rw-r--r--plugin/metrics/metrics.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/plugin/metrics/metrics.go b/plugin/metrics/metrics.go
index a49984b3d..e16749fc0 100644
--- a/plugin/metrics/metrics.go
+++ b/plugin/metrics/metrics.go
@@ -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"
)