@@ -56,40 +56,50 @@ func newIndexCache(reg prometheus.Registerer, maxBytes uint64) (*indexCache, err
56
56
Name : "thanos_store_index_cache_items_evicted_total" ,
57
57
Help : "Total number of items that were evicted from the index cache." ,
58
58
}, []string {"item_type" })
59
+ evicted .WithLabelValues (cacheTypePostings )
60
+ evicted .WithLabelValues (cacheTypeSeries )
59
61
60
62
c .added = prometheus .NewCounterVec (prometheus.CounterOpts {
61
63
Name : "thanos_store_index_cache_items_added_total" ,
62
64
Help : "Total number of items that were added to the index cache." ,
63
65
}, []string {"item_type" })
66
+ c .added .WithLabelValues (cacheTypePostings )
67
+ c .added .WithLabelValues (cacheTypeSeries )
64
68
65
69
c .requests = prometheus .NewCounterVec (prometheus.CounterOpts {
66
70
Name : "thanos_store_index_cache_requests_total" ,
67
71
Help : "Total number of requests to the cache." ,
68
72
}, []string {"item_type" })
73
+ c .requests .WithLabelValues (cacheTypePostings )
74
+ c .requests .WithLabelValues (cacheTypeSeries )
69
75
70
76
c .overflow = prometheus .NewCounterVec (prometheus.CounterOpts {
71
77
Name : "thanos_store_index_cache_items_overflowed_total" ,
72
78
Help : "Total number of items that could not be added to the cache due to being too big." ,
73
79
}, []string {"item_type" })
80
+ c .overflow .WithLabelValues (cacheTypePostings )
81
+ c .overflow .WithLabelValues (cacheTypeSeries )
74
82
75
83
c .hits = prometheus .NewCounterVec (prometheus.CounterOpts {
76
84
Name : "thanos_store_index_cache_hits_total" ,
77
85
Help : "Total number of requests to the cache that were a hit." ,
78
86
}, []string {"item_type" })
87
+ c .hits .WithLabelValues (cacheTypePostings )
88
+ c .hits .WithLabelValues (cacheTypeSeries )
79
89
80
90
c .current = prometheus .NewGaugeVec (prometheus.GaugeOpts {
81
91
Name : "thanos_store_index_cache_items" ,
82
92
Help : "Current number of items in the index cache." ,
83
93
}, []string {"item_type" })
94
+ c .current .WithLabelValues (cacheTypePostings )
95
+ c .current .WithLabelValues (cacheTypeSeries )
84
96
85
97
c .currentSize = prometheus .NewGaugeVec (prometheus.GaugeOpts {
86
98
Name : "thanos_store_index_cache_items_size_bytes" ,
87
99
Help : "Current byte size of items in the index cache." ,
88
100
}, []string {"item_type" })
89
-
90
- // Initialize eviction metric with 0.
91
- evicted .WithLabelValues (cacheTypePostings )
92
- evicted .WithLabelValues (cacheTypeSeries )
101
+ c .currentSize .WithLabelValues (cacheTypePostings )
102
+ c .currentSize .WithLabelValues (cacheTypeSeries )
93
103
94
104
// Initialize LRU cache with a high size limit since we will manage evictions ourselves
95
105
// based on stored size.
@@ -116,7 +126,7 @@ func newIndexCache(reg prometheus.Registerer, maxBytes uint64) (*indexCache, err
116
126
}, func () float64 {
117
127
return float64 (maxBytes )
118
128
}))
119
- reg .MustRegister (c .requests , c .hits , c .added , evicted , c .current , c .currentSize )
129
+ reg .MustRegister (c .requests , c .hits , c .added , evicted , c .current , c .currentSize , c . overflow )
120
130
}
121
131
return c , nil
122
132
}
0 commit comments