@@ -12,7 +12,7 @@ use std::sync::Arc;
1212use std:: time:: { Duration , Instant } ;
1313use tokio:: runtime:: Runtime ;
1414use tokio:: time:: sleep;
15- use tracing:: { debug, error, warn} ;
15+ use tracing:: { debug, error, info_span , warn, Instrument } ;
1616use types:: {
1717 BeaconBlock , BeaconBlockAltair , BeaconBlockBase , BeaconBlockBellatrix , BlobSidecar , ChainSpec ,
1818 EmptyBlock , Epoch , EthSpec , FixedBytesExtended , ForkName , Hash256 , MinimalEthSpec ,
@@ -117,7 +117,8 @@ fn test_tcp_status_rpc() {
117117 _ => { }
118118 }
119119 }
120- } ;
120+ }
121+ . instrument ( info_span ! ( "Sender" ) ) ;
121122
122123 // build the receiver future
123124 let receiver_future = async {
@@ -141,7 +142,8 @@ fn test_tcp_status_rpc() {
141142 _ => { } // Ignore other events
142143 }
143144 }
144- } ;
145+ }
146+ . instrument ( info_span ! ( "Receiver" ) ) ;
145147
146148 tokio:: select! {
147149 _ = sender_future => { }
@@ -245,7 +247,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
245247 _ => { } // Ignore other behaviour events
246248 }
247249 }
248- } ;
250+ }
251+ . instrument ( info_span ! ( "Sender" ) ) ;
249252
250253 // build the receiver future
251254 let receiver_future = async {
@@ -286,7 +289,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
286289 _ => { } // Ignore other events
287290 }
288291 }
289- } ;
292+ }
293+ . instrument ( info_span ! ( "Receiver" ) ) ;
290294
291295 tokio:: select! {
292296 _ = sender_future => { }
@@ -373,7 +377,8 @@ fn test_blobs_by_range_chunked_rpc() {
373377 _ => { } // Ignore other behaviour events
374378 }
375379 }
376- } ;
380+ }
381+ . instrument ( info_span ! ( "Sender" ) ) ;
377382
378383 // build the receiver future
379384 let receiver_future = async {
@@ -407,7 +412,8 @@ fn test_blobs_by_range_chunked_rpc() {
407412 _ => { } // Ignore other events
408413 }
409414 }
410- } ;
415+ }
416+ . instrument ( info_span ! ( "Receiver" ) ) ;
411417
412418 tokio:: select! {
413419 _ = sender_future => { }
@@ -479,7 +485,8 @@ fn test_tcp_blocks_by_range_over_limit() {
479485 _ => { } // Ignore other behaviour events
480486 }
481487 }
482- } ;
488+ }
489+ . instrument ( info_span ! ( "Sender" ) ) ;
483490
484491 // build the receiver future
485492 let receiver_future = async {
@@ -512,7 +519,8 @@ fn test_tcp_blocks_by_range_over_limit() {
512519 _ => { } // Ignore other events
513520 }
514521 }
515- } ;
522+ }
523+ . instrument ( info_span ! ( "Receiver" ) ) ;
516524
517525 tokio:: select! {
518526 _ = sender_future => { }
@@ -601,7 +609,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
601609 _ => { } // Ignore other behaviour events
602610 }
603611 }
604- } ;
612+ }
613+ . instrument ( info_span ! ( "Sender" ) ) ;
605614
606615 // determine messages to send (PeerId, RequestId). If some, indicates we still need to send
607616 // messages
@@ -648,7 +657,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
648657 }
649658 }
650659 }
651- } ;
660+ }
661+ . instrument ( info_span ! ( "Receiver" ) ) ;
652662
653663 tokio:: select! {
654664 _ = sender_future => { }
@@ -734,7 +744,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
734744 _ => { } // Ignore other behaviour events
735745 }
736746 }
737- } ;
747+ }
748+ . instrument ( info_span ! ( "Sender" ) ) ;
738749
739750 // build the receiver future
740751 let receiver_future = async {
@@ -767,7 +778,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
767778 _ => { } // Ignore other events
768779 }
769780 }
770- } ;
781+ }
782+ . instrument ( info_span ! ( "Receiver" ) ) ;
771783 tokio:: select! {
772784 _ = sender_future => { }
773785 _ = receiver_future => { }
@@ -877,7 +889,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
877889 _ => { } // Ignore other behaviour events
878890 }
879891 }
880- } ;
892+ }
893+ . instrument ( info_span ! ( "Sender" ) ) ;
881894
882895 // build the receiver future
883896 let receiver_future = async {
@@ -916,7 +929,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
916929 _ => { } // Ignore other events
917930 }
918931 }
919- } ;
932+ }
933+ . instrument ( info_span ! ( "Receiver" ) ) ;
920934 tokio:: select! {
921935 _ = sender_future => { }
922936 _ = receiver_future => { }
@@ -1015,7 +1029,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
10151029 _ => { } // Ignore other behaviour events
10161030 }
10171031 }
1018- } ;
1032+ }
1033+ . instrument ( info_span ! ( "Sender" ) ) ;
10191034
10201035 // determine messages to send (PeerId, RequestId). If some, indicates we still need to send
10211036 // messages
@@ -1062,7 +1077,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
10621077 }
10631078 }
10641079 }
1065- } ;
1080+ }
1081+ . instrument ( info_span ! ( "Receiver" ) ) ;
10661082
10671083 tokio:: select! {
10681084 _ = sender_future => { }
@@ -1115,7 +1131,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
11151131 _ => { } // Ignore other RPC messages
11161132 }
11171133 }
1118- } ;
1134+ }
1135+ . instrument ( info_span ! ( "Sender" ) ) ;
11191136
11201137 // build the receiver future
11211138 let receiver_future = async {
@@ -1125,7 +1142,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
11251142 return ;
11261143 }
11271144 }
1128- } ;
1145+ }
1146+ . instrument ( info_span ! ( "Receiver" ) ) ;
11291147
11301148 let total_future = futures:: future:: join ( sender_future, receiver_future) ;
11311149
0 commit comments