Cache metrics server (#1746)

* plugin/cache: per server metrics

Use per server metrics in the cache plugin as well. This required
some plumbing changes. Also use request.Request more.

* fix cherry-pick
This commit is contained in:
Miek Gieben 2018-04-27 19:37:49 +01:00 committed by GitHub
parent 85f549b529
commit bfc647d4ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 59 deletions

11
plugin/cache/setup.go vendored
View file

@ -36,21 +36,12 @@ func setup(c *caddy.Controller) error {
c.OnStartup(func() error {
once.Do(func() {
metrics.MustRegister(c,
cacheSize, cacheCapacity,
cacheHits, cacheMisses,
cacheSize, cacheHits, cacheMisses,
cachePrefetches, cacheDrops)
})
return nil
})
// Initialize all counters and gauges.
cacheSize.WithLabelValues(Success)
cacheSize.WithLabelValues(Denial)
cacheCapacity.WithLabelValues(Success).Set(float64(ca.pcap))
cacheCapacity.WithLabelValues(Denial).Set(float64(ca.ncap))
cacheHits.WithLabelValues(Success)
cacheHits.WithLabelValues(Denial)
return nil
}