16
16
17
17
use once_cell:: sync:: Lazy ;
18
18
use 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,
21
21
} ;
22
22
23
23
/// Counters associated to storage operations.
@@ -32,8 +32,6 @@ pub struct StorageMetrics {
32
32
pub get_slice_timeout_all_timeouts : IntCounter ,
33
33
pub object_storage_requests_total : IntCounterVec < 2 > ,
34
34
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 ,
37
35
pub object_storage_download_num_bytes : IntCounterVec < 1 > ,
38
36
pub object_storage_download_errors : IntCounterVec < 1 > ,
39
37
pub object_storage_upload_num_bytes : IntCounterVec < 1 > ,
@@ -84,19 +82,6 @@ impl Default for StorageMetrics {
84
82
[ "action" , "status" ] ,
85
83
vec ! [ 0.1 , 0.5 , 1.0 , 5.0 , 10.0 , 30.0 , 60.0 ] ,
86
84
) ,
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
- ) ,
100
85
object_storage_download_num_bytes : new_counter_vec (
101
86
"object_storage_download_num_bytes" ,
102
87
"Amount of data downloaded from object storage." ,
@@ -199,15 +184,11 @@ pub static STORAGE_METRICS: Lazy<StorageMetrics> = Lazy::new(StorageMetrics::def
199
184
pub static CACHE_METRICS_FOR_TESTS : Lazy < CacheMetrics > =
200
185
Lazy :: new ( || CacheMetrics :: for_component ( "fortest" ) ) ;
201
186
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 ) ;
208
192
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
213
194
}
0 commit comments