Miek Gieben 4df416ca1d
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)
2018-04-01 13:57:03 +01:00
..
2018-02-08 10:55:51 +00:00
2018-02-28 19:56:14 -08:00
2018-03-25 17:11:10 +01:00
2018-02-08 10:55:51 +00:00
2018-01-04 12:53:07 +00:00
2018-03-13 16:33:11 -04:00
2018-04-01 13:57:03 +01:00
2018-03-02 17:17:26 -08:00
2018-02-28 19:56:14 -08:00
2018-03-09 15:08:57 -05:00
2018-02-28 19:56:14 -08:00
2017-10-24 10:16:03 +01:00
2018-04-01 13:57:03 +01:00