File tree 5 files changed +30
-0
lines changed
quickwit/quickwit-storage/src
5 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,8 @@ impl<T: 'static + ToOwned + ?Sized + Ord> NeedMutByteRangeCache<T> {
314
314
self . num_bytes -= num_bytes as u64 ;
315
315
self . cache_counters . in_cache_count . dec ( ) ;
316
316
self . cache_counters . in_cache_num_bytes . sub ( num_bytes as i64 ) ;
317
+ self . cache_counters . evict_num_items . inc ( ) ;
318
+ self . cache_counters . evict_num_bytes . inc_by ( num_bytes as u64 ) ;
317
319
}
318
320
}
319
321
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ struct NeedMutMemorySizedCache<K: Hash + Eq> {
74
74
75
75
impl < K : Hash + Eq > Drop for NeedMutMemorySizedCache < K > {
76
76
fn drop ( & mut self ) {
77
+ // we don't count this toward evicted entries, as we are clearing the whole cache
77
78
self . cache_counters
78
79
. in_cache_count
79
80
. sub ( self . num_items as i64 ) ;
@@ -110,6 +111,8 @@ impl<K: Hash + Eq> NeedMutMemorySizedCache<K> {
110
111
self . num_bytes -= num_bytes;
111
112
self . cache_counters . in_cache_count . dec ( ) ;
112
113
self . cache_counters . in_cache_num_bytes . sub ( num_bytes as i64 ) ;
114
+ self . cache_counters . evict_num_items . inc ( ) ;
115
+ self . cache_counters . evict_num_bytes . inc_by ( num_bytes) ;
113
116
}
114
117
115
118
pub fn get < Q > ( & mut self , cache_key : & Q ) -> Option < OwnedBytes >
Original file line number Diff line number Diff line change @@ -119,6 +119,9 @@ impl FileDescriptorCache {
119
119
self . fd_cache_metrics
120
120
. in_cache_count
121
121
. set ( fd_cache_lock. len ( ) as i64 ) ;
122
+ self . fd_cache_metrics
123
+ . evict_num_items
124
+ . inc_by ( split_ids. len ( ) as u64 ) ;
122
125
}
123
126
124
127
pub async fn get_or_open_split_file (
Original file line number Diff line number Diff line change @@ -120,6 +120,8 @@ pub struct CacheMetrics {
120
120
pub hits_num_items : IntCounter ,
121
121
pub hits_num_bytes : IntCounter ,
122
122
pub misses_num_items : IntCounter ,
123
+ pub evict_num_items : IntCounter ,
124
+ pub evict_num_bytes : IntCounter ,
123
125
}
124
126
125
127
impl CacheMetrics {
@@ -157,6 +159,18 @@ impl CacheMetrics {
157
159
CACHE_METRICS_NAMESPACE ,
158
160
& [ ( "component_name" , component_name) ] ,
159
161
) ,
162
+ evict_num_items : new_counter_with_labels (
163
+ "cache_evict_total" ,
164
+ "Number of cache entry evicted by component" ,
165
+ CACHE_METRICS_NAMESPACE ,
166
+ & [ ( "component_name" , component_name) ] ,
167
+ ) ,
168
+ evict_num_bytes : new_counter_with_labels (
169
+ "cache_evict_bytes" ,
170
+ "Number of cache entry evicted in bytes by component" ,
171
+ CACHE_METRICS_NAMESPACE ,
172
+ & [ ( "component_name" , component_name) ] ,
173
+ ) ,
160
174
}
161
175
}
162
176
}
Original file line number Diff line number Diff line change @@ -165,6 +165,14 @@ impl SplitTable {
165
165
. searcher_split_cache
166
166
. in_cache_num_bytes
167
167
. sub ( num_bytes as i64 ) ;
168
+ crate :: metrics:: STORAGE_METRICS
169
+ . searcher_split_cache
170
+ . evict_num_items
171
+ . inc ( ) ;
172
+ crate :: metrics:: STORAGE_METRICS
173
+ . searcher_split_cache
174
+ . evict_num_bytes
175
+ . inc_by ( num_bytes) ;
168
176
& mut self . on_disk_splits
169
177
}
170
178
} ;
You can’t perform that action at this time.
0 commit comments