9090 fn new ( shared : ProxyHttpSharedState < C , P > , connections_limit : usize ) -> Self {
9191 let id = Uuid :: now_v7 ( ) ;
9292
93- debug ! ( proxy = P :: name ( ) , worker_id = %id, "Creating http-proxy worker..." ) ;
93+ debug ! ( proxy = shared . proxy_name , worker_id = %id, "Creating http-proxy worker..." ) ;
9494
9595 let config = shared. config ( ) ;
9696 let inner = shared. inner ( ) ;
@@ -151,7 +151,7 @@ where
151151 Ok ( listener) => listener,
152152 Err ( err) => {
153153 error ! (
154- proxy = P :: name ( ) ,
154+ proxy = proxy_name ,
155155 addr = %config. listen_address( ) ,
156156 error = ?err,
157157 "Failed to initialise a socket"
@@ -179,7 +179,7 @@ where
179179 let client_connections_count = shared. client_connections_count . clone ( ) ;
180180
181181 info ! (
182- proxy = P :: name ( ) ,
182+ proxy = proxy_name ,
183183 listen_address = %listen_address,
184184 workers_count = workers_count,
185185 max_concurrent_requests_per_worker = max_concurrent_requests_per_worker,
@@ -216,7 +216,7 @@ where
216216 Ok ( server) => server,
217217 Err ( err) => {
218218 error ! (
219- proxy = P :: name ( ) ,
219+ proxy = proxy_name ,
220220 error = ?err,
221221 "Failed to initialise http-proxy" ,
222222 ) ;
@@ -229,16 +229,16 @@ where
229229 let mut resetter = resetter. subscribe ( ) ;
230230 tokio:: spawn ( async move {
231231 if resetter. recv ( ) . await . is_ok ( ) {
232- info ! ( proxy = P :: name ( ) , "Reset signal received, stopping http-proxy..." ) ;
232+ info ! ( proxy = proxy_name , "Reset signal received, stopping http-proxy..." ) ;
233233 handler. stop ( true ) . await ;
234234 }
235235 } ) ;
236236
237237 if let Err ( err) = server. await {
238- error ! ( proxy = P :: name ( ) , error = ?err, "Failure while running http-proxy" )
238+ error ! ( proxy = proxy_name , error = ?err, "Failure while running http-proxy" )
239239 }
240240
241- info ! ( proxy = P :: name ( ) , "Stopped http-proxy" ) ;
241+ info ! ( proxy = proxy_name , "Stopped http-proxy" ) ;
242242
243243 Ok ( ( ) )
244244 }
@@ -329,7 +329,7 @@ where
329329 Ok ( res) => res,
330330 Err ( err) => {
331331 warn ! (
332- proxy = P :: name ( ) ,
332+ proxy = this . shared . proxy_name ,
333333 request_id = %id,
334334 connection_id = %connection_id,
335335 worker_id = %this. id,
@@ -368,7 +368,7 @@ where
368368
369369 if self . requests . insert_sync ( id, req) . is_err ( ) {
370370 error ! (
371- proxy = P :: name ( ) ,
371+ proxy = self . shared . proxy_name ,
372372 request_id = %id,
373373 connection_id = %connection_id,
374374 worker_id = %self . id,
@@ -382,7 +382,7 @@ where
382382 Some ( ( _, req) ) => req,
383383 None => {
384384 error ! (
385- proxy = P :: name ( ) ,
385+ proxy = self . shared . proxy_name ,
386386 request_id = %bck_res. info. id,
387387 worker_id = %self . id,
388388 "Proxied http response for unmatching request" ,
@@ -444,6 +444,7 @@ where
444444 & cli_req,
445445 & bck_res,
446446 inner. clone ( ) ,
447+ proxy_name,
447448 worker_id,
448449 ) ;
449450
@@ -458,7 +459,7 @@ where
458459
459460 Err ( err) => {
460461 warn ! (
461- proxy = P :: name ( ) ,
462+ proxy = proxy_name ,
462463 request_id = %cli_req. info. id,
463464 connection_id = %cli_req. info. connection_id,
464465 worker_id = %worker_id,
@@ -487,7 +488,7 @@ where
487488 decompress ( mrr_res. body . clone ( ) , mrr_res. size , mrr_res. info . content_encoding ( ) ) ;
488489 }
489490
490- Self :: maybe_log_mirrored_request ( & cli_req, & mrr_res, worker_id, inner. config ( ) ) ;
491+ Self :: maybe_log_mirrored_request ( & cli_req, & mrr_res, proxy_name , worker_id, inner. config ( ) ) ;
491492
492493 metrics
493494 . http_mirror_success_count
@@ -503,6 +504,7 @@ where
503504 req : & ProxiedHttpRequest ,
504505 res : & ProxiedHttpResponse ,
505506 inner : Arc < P > ,
507+ proxy_name : & ' static str ,
506508 worker_id : Uuid ,
507509 ) {
508510 let config = inner. config ( ) ;
@@ -526,7 +528,7 @@ where
526528 } ;
527529
528530 info ! (
529- proxy = P :: name ( ) ,
531+ proxy = proxy_name ,
530532 request_id = %req. info. id,
531533 connection_id = %req. info. connection_id,
532534 worker_id = %worker_id,
@@ -545,6 +547,7 @@ where
545547 fn maybe_log_mirrored_request (
546548 req : & ProxiedHttpRequest ,
547549 res : & ProxiedHttpResponse ,
550+ proxy_name : & ' static str ,
548551 worker_id : Uuid ,
549552 config : & C ,
550553 ) {
@@ -567,7 +570,7 @@ where
567570 } ;
568571
569572 info ! (
570- proxy = P :: name ( ) ,
573+ proxy = proxy_name ,
571574 request_id = %req. info. id,
572575 connection_id = %req. info. connection_id,
573576 worker_id = %worker_id,
@@ -820,7 +823,7 @@ where
820823{
821824 fn drop ( & mut self ) {
822825 debug ! (
823- proxy = P :: name ( ) ,
826+ proxy = self . shared . proxy_name ,
824827 worker_id = %self . id,
825828 "Destroying http-proxy worker..." ,
826829 ) ;
@@ -1067,7 +1070,7 @@ where
10671070 }
10681071 Err ( err) => {
10691072 warn ! (
1070- proxy = P :: name ( ) ,
1073+ proxy = proxy_name ,
10711074 request_id = %cli_req. info. id,
10721075 connection_id = %cli_req. info. connection_id,
10731076 error = ?err,
@@ -1083,7 +1086,7 @@ where
10831086
10841087 Err ( err) => {
10851088 warn ! (
1086- proxy = P :: name ( ) ,
1089+ proxy = proxy_name ,
10871090 request_id = %cli_req. info. id,
10881091 connection_id = %cli_req. info. connection_id,
10891092 error = ?err,
@@ -1309,15 +1312,15 @@ where
13091312 Poll :: Ready ( Some ( Err ( err) ) ) => {
13101313 if let Some ( info) = mem:: take ( this. info ) {
13111314 warn ! (
1312- proxy = P :: name ( ) ,
1315+ proxy = this . proxy . shared . proxy_name ,
13131316 request_id = %info. id( ) ,
13141317 connection_id = %info. connection_id( ) ,
13151318 error = ?err,
13161319 "Proxy http request stream error" ,
13171320 ) ;
13181321 } else {
13191322 warn ! (
1320- proxy = P :: name ( ) ,
1323+ proxy = this . proxy . shared . proxy_name ,
13211324 error = ?err,
13221325 request_id = "unknown" ,
13231326 "Proxy http request stream error" ,
@@ -1407,14 +1410,14 @@ where
14071410 Poll :: Ready ( Some ( Err ( err) ) ) => {
14081411 if let Some ( info) = mem:: take ( this. info ) {
14091412 warn ! (
1410- proxy = P :: name ( ) ,
1413+ proxy = this . proxy . shared . proxy_name ,
14111414 request_id = %info. id( ) ,
14121415 error = ?err,
14131416 "Proxy http response stream error" ,
14141417 ) ;
14151418 } else {
14161419 warn ! (
1417- proxy = P :: name ( ) ,
1420+ proxy = this . proxy . shared . proxy_name ,
14181421 error = ?err,
14191422 request_id = "unknown" ,
14201423 "Proxy http response stream error" ,
0 commit comments