@@ -15,6 +15,7 @@ type CacheList map[string]func() *cache.Stats
15
15
type CacheCollector struct {
16
16
Stats CacheList
17
17
counter * prometheus.Desc
18
+ gauge * prometheus.Desc
18
19
}
19
20
20
21
// Describe satisfies the Collector interface for prometheus.
@@ -26,7 +27,7 @@ func (c *CacheCollector) Describe(ch chan<- *prometheus.Desc) {
26
27
func (c * CacheCollector ) Collect (ch chan <- prometheus.Metric ) {
27
28
for label , stats := range c .Stats {
28
29
cache := stats ()
29
- ch <- prometheus .MustNewConstMetric (c .counter , prometheus .GaugeValue , float64 (cache .Size ), label , "size" )
30
+ ch <- prometheus .MustNewConstMetric (c .gauge , prometheus .GaugeValue , float64 (cache .Size ), label , "size" )
30
31
ch <- prometheus .MustNewConstMetric (c .counter , prometheus .CounterValue , float64 (cache .Gets ), label , "gets" )
31
32
ch <- prometheus .MustNewConstMetric (c .counter , prometheus .CounterValue , float64 (cache .Hits ), label , "hits" )
32
33
ch <- prometheus .MustNewConstMetric (c .counter , prometheus .CounterValue , float64 (cache .Misses ), label , "misses" )
@@ -59,6 +60,7 @@ type Metrics struct {
59
60
func GetMetrics (collector * CacheCollector ) * Metrics {
60
61
start := time .Now ()
61
62
collector .counter = prometheus .NewDesc ("authproxy_cache_counters" , "All cache counters" , []string {"cache" , "counter" }, nil )
63
+ collector .gauge = prometheus .NewDesc ("authproxy_cache_guages" , "All cache gauges" , []string {"cache" , "gauge" }, nil )
62
64
prometheus .MustRegister (collector )
63
65
64
66
return & Metrics {
0 commit comments