@@ -25,6 +25,8 @@ use runtime::{
25
25
} ;
26
26
use secret:: SecretStrategy ;
27
27
use smol_str:: SmolStr ;
28
+ #[ cfg( feature = "stats" ) ]
29
+ use smol_str:: ToSmolStr ;
28
30
use state:: HttpState ;
29
31
use tokio:: { net:: TcpListener , time:: error:: Elapsed } ;
30
32
pub use wasmtime_wasi_http:: body:: HyperOutgoingBody ;
@@ -311,11 +313,11 @@ where
311
313
let start_ = std:: time:: Instant :: now ( ) ;
312
314
313
315
let response_handler = {
314
- let app_name = app_name. to_string ( ) ;
316
+ let app_name = app_name. clone ( ) ;
315
317
#[ cfg( feature = "stats" ) ]
316
- let billing_plan = cfg. plan . to_string ( ) ;
318
+ let billing_plan = cfg. plan . clone ( ) ;
317
319
#[ cfg( feature = "stats" ) ]
318
- let request_id = request_id. to_string ( ) ;
320
+ let request_id = request_id. to_smolstr ( ) ;
319
321
#[ cfg( feature = "stats" ) ]
320
322
let context = self . context . clone ( ) ;
321
323
@@ -340,7 +342,6 @@ where
340
342
time_elapsed : time_elapsed. as_micros ( ) as u64 ,
341
343
memory_used : mem_used. as_u64 ( ) ,
342
344
request_id,
343
- ..Default :: default ( )
344
345
} ;
345
346
context. write_stats ( stat_row) ;
346
347
}
@@ -377,14 +378,13 @@ where
377
378
app_id : cfg. app_id ,
378
379
client_id : cfg. client_id ,
379
380
timestamp : timestamp as u32 ,
380
- app_name : app_name. to_string ( ) ,
381
+ app_name : app_name,
381
382
status_code : status_code as u32 ,
382
383
fail_reason : fail_reason as u32 ,
383
- billing_plan : cfg. plan . to_string ( ) ,
384
+ billing_plan : cfg. plan . clone ( ) ,
384
385
time_elapsed : time_elapsed. as_micros ( ) as u64 ,
385
386
memory_used : 0 ,
386
- request_id : request_id. to_string ( ) ,
387
- ..Default :: default ( )
387
+ request_id : request_id. to_smolstr ( ) ,
388
388
} ;
389
389
self . context . write_stats ( stat_row) ;
390
390
}
0 commit comments