@@ -12,6 +12,7 @@ use http::Response;
12
12
use hyper:: Body ;
13
13
use std:: collections:: HashMap ;
14
14
use std:: sync:: { Arc , Condvar , Mutex } ;
15
+ use std:: time:: Instant ;
15
16
use warp:: { self , Filter , Rejection } ;
16
17
17
18
#[ derive( Deserialize ) ]
@@ -214,7 +215,7 @@ impl RecordProgressThread {
214
215
215
216
metrics
216
217
. crater_endpoint_time
217
- . with_label_values ( & [ "record_progress " ] )
218
+ . with_label_values ( & [ "record_progress_worker " ] )
218
219
. observe ( start. elapsed ( ) . as_secs_f64 ( ) ) ;
219
220
}
220
221
} ) ) ;
@@ -298,14 +299,23 @@ fn endpoint_record_progress(
298
299
data : Arc < Data > ,
299
300
_auth : AuthDetails ,
300
301
) -> Fallible < Response < Body > > {
301
- match data. record_progress_worker . queue . try_send ( result) {
302
+ let start = Instant :: now ( ) ;
303
+
304
+ let ret = match data. record_progress_worker . queue . try_send ( result) {
302
305
Ok ( ( ) ) => Ok ( ApiResponse :: Success { result : true } . into_response ( ) ?) ,
303
306
Err ( crossbeam_channel:: TrySendError :: Full ( _) ) => {
304
307
data. metrics . crater_bounced_record_progress . inc_by ( 1 ) ;
305
308
Ok ( ApiResponse :: < ( ) > :: SlowDown . into_response ( ) ?)
306
309
}
307
310
Err ( crossbeam_channel:: TrySendError :: Disconnected ( _) ) => unreachable ! ( ) ,
308
- }
311
+ } ;
312
+
313
+ data. metrics
314
+ . crater_endpoint_time
315
+ . with_label_values ( & [ "record_progress_endpoint" ] )
316
+ . observe ( start. elapsed ( ) . as_secs_f64 ( ) ) ;
317
+
318
+ ret
309
319
}
310
320
311
321
fn endpoint_heartbeat ( data : Arc < Data > , auth : AuthDetails ) -> Fallible < Response < Body > > {
0 commit comments