Skip to content

Commit 7ab18bf

Browse files
committed
fix guage
1 parent fa0aa41 commit 7ab18bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/exp/metrics.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type CacheList map[string]func() *cache.Stats
1515
type CacheCollector struct {
1616
Stats CacheList
1717
counter *prometheus.Desc
18+
gauge *prometheus.Desc
1819
}
1920

2021
// Describe satisfies the Collector interface for prometheus.
@@ -26,7 +27,7 @@ func (c *CacheCollector) Describe(ch chan<- *prometheus.Desc) {
2627
func (c *CacheCollector) Collect(ch chan<- prometheus.Metric) {
2728
for label, stats := range c.Stats {
2829
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")
3031
ch <- prometheus.MustNewConstMetric(c.counter, prometheus.CounterValue, float64(cache.Gets), label, "gets")
3132
ch <- prometheus.MustNewConstMetric(c.counter, prometheus.CounterValue, float64(cache.Hits), label, "hits")
3233
ch <- prometheus.MustNewConstMetric(c.counter, prometheus.CounterValue, float64(cache.Misses), label, "misses")
@@ -59,6 +60,7 @@ type Metrics struct {
5960
func GetMetrics(collector *CacheCollector) *Metrics {
6061
start := time.Now()
6162
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)
6264
prometheus.MustRegister(collector)
6365

6466
return &Metrics{

0 commit comments

Comments
 (0)