@@ -144,8 +144,8 @@ where
144144 let request_id = remote_traceparent( & req) ;
145145 async move {
146146 self_
147- . handle_request( & request_id, req)
148- . instrument( tracing:: debug_span!( "http" , request_id) )
147+ . handle_request( request_id. clone ( ) , req)
148+ . instrument( tracing:: debug_span!( "http" , ? request_id) )
149149 . await
150150 }
151151 } ) ;
@@ -228,7 +228,7 @@ where
228228 /// handle HTTP request.
229229 async fn handle_request < B > (
230230 & self ,
231- request_id : & str ,
231+ request_id : SmolStr ,
232232 mut request : hyper:: Request < B > ,
233233 ) -> Result < hyper:: Response < HyperOutgoingBody > >
234234 where
@@ -312,7 +312,7 @@ where
312312
313313 let stats = self
314314 . context
315- . new_stats_row ( request_id. to_smolstr ( ) , app_name. clone ( ) , & cfg) ;
315+ . new_stats_row ( & request_id, & app_name, & cfg) ;
316316
317317 let response = match executor. execute ( request, stats. clone ( ) ) . await {
318318 Ok ( mut response) => {
@@ -332,7 +332,7 @@ where
332332 let ( status_code, fail_reason, msg) = map_err ( error) ;
333333 stats. status_code ( status_code) ;
334334 stats. fail_reason ( fail_reason as u32 ) ;
335- tracing:: debug!( ?fail_reason, request_id, "stats" ) ;
335+ tracing:: debug!( ?fail_reason, ? request_id, "stats" ) ;
336336
337337 #[ cfg( feature = "metrics" ) ]
338338 metrics:: metrics (
@@ -426,12 +426,12 @@ fn map_err(error: Error) -> (u16, AppResult, HyperOutgoingBody) {
426426 ( status_code, fail_reason, msg)
427427}
428428
429- fn remote_traceparent ( req : & hyper:: Request < hyper:: body:: Incoming > ) -> String {
429+ fn remote_traceparent ( req : & hyper:: Request < hyper:: body:: Incoming > ) -> SmolStr {
430430 req. headers ( )
431431 . get ( TRACEPARENT )
432432 . and_then ( |v| v. to_str ( ) . ok ( ) )
433- . map ( |s| s. to_string ( ) )
434- . unwrap_or ( nanoid:: nanoid!( ) )
433+ . map ( |s| s. to_smolstr ( ) )
434+ . unwrap_or ( nanoid:: nanoid!( ) . to_smolstr ( ) )
435435}
436436
437437/// Creates an HTTP 500 response.
0 commit comments