1616
1717use once_cell:: sync:: Lazy ;
1818use quickwit_common:: metrics:: {
19- GaugeGuard , HistogramVec , IntCounter , IntCounterVec , IntGauge , new_counter , new_counter_vec ,
20- new_gauge, new_histogram_vec,
19+ GaugeGuard , HistogramVec , IntCounter , IntCounterVec , IntGauge , MEMORY_METRICS , new_counter ,
20+ new_counter_vec , new_gauge, new_histogram_vec,
2121} ;
2222
2323/// Counters associated to storage operations.
@@ -32,8 +32,6 @@ pub struct StorageMetrics {
3232 pub get_slice_timeout_all_timeouts : IntCounter ,
3333 pub object_storage_requests_total : IntCounterVec < 2 > ,
3434 pub object_storage_request_duration : HistogramVec < 2 > ,
35- pub object_storage_get_slice_in_flight_count : IntGauge ,
36- pub object_storage_get_slice_in_flight_num_bytes : IntGauge ,
3735 pub object_storage_download_num_bytes : IntCounterVec < 1 > ,
3836 pub object_storage_download_errors : IntCounterVec < 1 > ,
3937 pub object_storage_upload_num_bytes : IntCounterVec < 1 > ,
@@ -84,19 +82,6 @@ impl Default for StorageMetrics {
8482 [ "action" , "status" ] ,
8583 vec ! [ 0.1 , 0.5 , 1.0 , 5.0 , 10.0 , 30.0 , 60.0 ] ,
8684 ) ,
87- object_storage_get_slice_in_flight_count : new_gauge (
88- "object_storage_get_slice_in_flight_count" ,
89- "Number of get_object for which the memory was allocated but the download is \
90- still in progress.",
91- "storage" ,
92- & [ ] ,
93- ) ,
94- object_storage_get_slice_in_flight_num_bytes : new_gauge (
95- "object_storage_get_slice_in_flight_num_bytes" ,
96- "Memory allocated for get_object requests that are still in progress." ,
97- "storage" ,
98- & [ ] ,
99- ) ,
10085 object_storage_download_num_bytes : new_counter_vec (
10186 "object_storage_download_num_bytes" ,
10287 "Amount of data downloaded from object storage." ,
@@ -199,15 +184,11 @@ pub static STORAGE_METRICS: Lazy<StorageMetrics> = Lazy::new(StorageMetrics::def
199184pub static CACHE_METRICS_FOR_TESTS : Lazy < CacheMetrics > =
200185 Lazy :: new ( || CacheMetrics :: for_component ( "fortest" ) ) ;
201186
202- pub fn object_storage_get_slice_in_flight_guards (
203- get_request_size : usize ,
204- ) -> ( GaugeGuard < ' static > , GaugeGuard < ' static > ) {
205- let mut bytes_guard = GaugeGuard :: from_gauge (
206- & crate :: STORAGE_METRICS . object_storage_get_slice_in_flight_num_bytes ,
207- ) ;
187+ /// Helps tracking pre-allocated memory for downloads that are still in progress.
188+ ///
189+ /// This is actually recorded as a memory metric and not a storage metric.
190+ pub fn object_storage_get_slice_in_flight_guards ( get_request_size : usize ) -> GaugeGuard < ' static > {
191+ let mut bytes_guard = GaugeGuard :: from_gauge ( & MEMORY_METRICS . in_flight . get_object ) ;
208192 bytes_guard. add ( get_request_size as i64 ) ;
209- let mut count_guard =
210- GaugeGuard :: from_gauge ( & crate :: STORAGE_METRICS . object_storage_get_slice_in_flight_count ) ;
211- count_guard. add ( 1 ) ;
212- ( bytes_guard, count_guard)
193+ bytes_guard
213194}
0 commit comments