@@ -537,16 +537,27 @@ impl hyper::server::Service for ApiServerHttpService {
537
537
// available.
538
538
Either :: B (
539
539
outcome_receiver
540
- . map ( move |x| {
541
- info ! (
542
- "Received Success on {}" ,
543
- describe( & method_copy, & path_copy, & b_str)
544
- ) ;
545
- x. generate_response ( )
540
+ . map ( move |result| {
541
+ let description = describe ( & method_copy, & path_copy, & b_str) ;
542
+ // `generate_response` and `err` both consume the inner error.
543
+ // Errors aren't `Clone`-able so we can't back it up either,
544
+ // so we'll rely on the fact that the error was previously
545
+ // logged at its point of origin and not log it again.
546
+ let response = result. generate_response ( ) ;
547
+ let status_code = response. status ( ) ;
548
+ if result. is_ok ( ) {
549
+ info ! (
550
+ "Received Success {} on {}" ,
551
+ status_code, description
552
+ ) ;
553
+ } else {
554
+ error ! ( "Received Error {} on {}" , status_code, description) ;
555
+ }
556
+ response
546
557
} )
547
558
. map_err ( move |_| {
548
- info ! (
549
- "Received Error on {}" ,
559
+ error ! (
560
+ "Timeout on {}" ,
550
561
describe( & method_copy_err, & path_copy_err, & b_str_err)
551
562
) ;
552
563
METRICS . api_server . sync_outcome_fails . inc ( ) ;
@@ -561,9 +572,14 @@ impl hyper::server::Service for ApiServerHttpService {
561
572
}
562
573
}
563
574
564
- /// Helper function for metric-logging purposes on API requests
565
- /// `method` is whether PUT or GET
566
- /// `path` and `body` represent path of the API request and body, respectively
575
+ /// Helper function for metric-logging purposes on API requests.
576
+ ///
577
+ /// # Arguments
578
+ ///
579
+ /// * `method` - one of `GET`, `PATCH`, `PUT`
580
+ /// * `path` - path of the API request
581
+ /// * `body` - body of the API request
582
+ ///
567
583
fn describe ( method : & Method , path : & String , body : & String ) -> String {
568
584
format ! (
569
585
"synchronous {:?} request {:?} with body {:?}" ,
0 commit comments