aboutsummaryrefslogtreecommitdiff
path: root/plugin/metrics/context.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-03-25Remove server addr from the context (#2722)Gravatar Miek Gieben 1-2/+8
* more Signed-off-by: Miek Gieben <miek@miek.nl> * Remove server addr from the context This was added twice, just leave the server which also holds the address. Conflicts with #2719 but should be easy to fix. Signed-off-by: Miek Gieben <miek@miek.nl> * doesn't need server context Signed-off-by: Miek Gieben <miek@miek.nl>
2018-04-22all: fix plugin import ordering (#1717)Gravatar Miek Gieben 1-2/+2
Got a bit messed up with stb lib "context" usage.
2018-04-20global: move to context (#1699)Gravatar Miek Gieben 1-1/+1
* global: move to context Move from golang.org/x/net/context to std lib's context. Change done with: for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done for i in **/*.go; do goimports -w $i; done * drop from dns.pb.go as well
2018-04-18plugin/metrics: add 'server' label (#1682)Gravatar Miek Gieben 1-8/+2
* plugin/metrics: add 'server' label This uses the new WithServer(ctx) to get the current server from the context. First in a larger refactor to make all plugins do this. * compile * compile * lala test * compile and test * typos * Dont duplicate the code
2018-04-01Metrics (#1579)Gravatar Miek Gieben 1-0/+24
* 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)