@@ -35,6 +35,7 @@ use linera_views::{
3535 views:: { ClonableView , CryptoHashView , RootView , View } ,
3636} ;
3737use serde:: { Deserialize , Serialize } ;
38+ use tracing:: instrument;
3839
3940use crate :: {
4041 block:: { Block , ConfirmedBlock } ,
@@ -388,6 +389,9 @@ where
388389 self . context ( ) . extra ( ) . chain_id ( )
389390 }
390391
392+ #[ instrument( target = "telemetry_only" , skip_all, fields(
393+ chain_id = %self . chain_id( ) ,
394+ ) ) ]
391395 pub async fn query_application (
392396 & mut self ,
393397 local_time : Timestamp ,
@@ -405,6 +409,10 @@ where
405409 . with_execution_context ( ChainExecutionContext :: Query )
406410 }
407411
412+ #[ instrument( target = "telemetry_only" , skip_all, fields(
413+ chain_id = %self . chain_id( ) ,
414+ application_id = %application_id
415+ ) ) ]
408416 pub async fn describe_application (
409417 & mut self ,
410418 application_id : ApplicationId ,
@@ -416,6 +424,11 @@ where
416424 . with_execution_context ( ChainExecutionContext :: DescribeApplication )
417425 }
418426
427+ #[ instrument( target = "telemetry_only" , skip_all, fields(
428+ chain_id = %self . chain_id( ) ,
429+ target = %target,
430+ height = %height
431+ ) ) ]
419432 pub async fn mark_messages_as_received (
420433 & mut self ,
421434 target : & ChainId ,
@@ -503,6 +516,9 @@ where
503516
504517 /// Verifies that this chain is up-to-date and all the messages executed ahead of time
505518 /// have been properly received by now.
519+ #[ instrument( target = "telemetry_only" , skip_all, fields(
520+ chain_id = %self . chain_id( )
521+ ) ) ]
506522 pub async fn validate_incoming_bundles ( & self ) -> Result < ( ) , ChainError > {
507523 let chain_id = self . chain_id ( ) ;
508524 let pairs = self . inboxes . try_load_all_entries ( ) . await ?;
@@ -564,6 +580,11 @@ where
564580 /// round timeouts.
565581 ///
566582 /// Returns `true` if incoming `Subscribe` messages created new outbox entries.
583+ #[ instrument( target = "telemetry_only" , skip_all, fields(
584+ chain_id = %self . chain_id( ) ,
585+ origin = %origin,
586+ bundle_height = %bundle. height
587+ ) ) ]
567588 pub async fn receive_message_bundle (
568589 & mut self ,
569590 origin : & ChainId ,
@@ -658,6 +679,9 @@ where
658679 }
659680
660681 /// Removes the incoming message bundles in the block from the inboxes.
682+ #[ instrument( target = "telemetry_only" , skip_all, fields(
683+ chain_id = %self . chain_id( ) ,
684+ ) ) ]
661685 pub async fn remove_bundles_from_inboxes (
662686 & mut self ,
663687 timestamp : Timestamp ,
@@ -747,6 +771,10 @@ where
747771
748772 /// Executes a block: first the incoming messages, then the main operation.
749773 /// Does not update chain state other than the execution state.
774+ #[ instrument( target = "telemetry_only" , skip_all, fields(
775+ chain_id = %block. chain_id,
776+ block_height = %block. height
777+ ) ) ]
750778 #[ expect( clippy:: too_many_arguments) ]
751779 async fn execute_block_inner (
752780 chain : & mut ExecutionStateView < C > ,
@@ -856,6 +884,10 @@ where
856884
857885 /// Executes a block: first the incoming messages, then the main operation.
858886 /// Does not update chain state other than the execution state.
887+ #[ instrument( target = "telemetry_only" , skip_all, fields(
888+ chain_id = %self . chain_id( ) ,
889+ block_height = %block. height
890+ ) ) ]
859891 pub async fn execute_block (
860892 & mut self ,
861893 block : & ProposedBlock ,
@@ -915,6 +947,11 @@ where
915947
916948 /// Applies an execution outcome to the chain, updating the outboxes, state hash and chain
917949 /// manager. This does not touch the execution state itself, which must be updated separately.
950+ /// Returns the set of event streams that were updated as a result of applying the block.
951+ #[ instrument( target = "telemetry_only" , skip_all, fields(
952+ chain_id = %self . chain_id( ) ,
953+ block_height = %block. inner( ) . inner( ) . header. height
954+ ) ) ]
918955 pub async fn apply_confirmed_block (
919956 & mut self ,
920957 block : & ConfirmedBlock ,
@@ -947,6 +984,10 @@ where
947984 }
948985
949986 /// Adds a block to `preprocessed_blocks`, and updates the outboxes where possible.
987+ #[ instrument( target = "telemetry_only" , skip_all, fields(
988+ chain_id = %self . chain_id( ) ,
989+ block_height = %block. inner( ) . inner( ) . header. height
990+ ) ) ]
950991 pub async fn preprocess_block ( & mut self , block : & ConfirmedBlock ) -> Result < ( ) , ChainError > {
951992 let hash = block. inner ( ) . hash ( ) ;
952993 let block = block. inner ( ) . inner ( ) ;
@@ -969,6 +1010,10 @@ where
9691010 }
9701011
9711012 /// Verifies that the block is valid according to the chain's application permission settings.
1013+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1014+ block_height = %block. height,
1015+ num_transactions = %block. transactions. len( )
1016+ ) ) ]
9721017 fn check_app_permissions (
9731018 app_permissions : & ApplicationPermissions ,
9741019 block : & ProposedBlock ,
@@ -1011,6 +1056,10 @@ where
10111056 }
10121057
10131058 /// Returns the hashes of all blocks we have in the given range.
1059+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1060+ chain_id = %self . chain_id( ) ,
1061+ next_block_height = %self . tip_state. get( ) . next_block_height
1062+ ) ) ]
10141063 pub async fn block_hashes (
10151064 & self ,
10161065 range : impl RangeBounds < BlockHeight > ,
@@ -1056,6 +1105,10 @@ where
10561105 /// Updates the outboxes with the messages sent in the block.
10571106 ///
10581107 /// Returns the set of all recipients.
1108+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1109+ chain_id = %self . chain_id( ) ,
1110+ block_height = %block. header. height
1111+ ) ) ]
10591112 async fn process_outgoing_messages (
10601113 & mut self ,
10611114 block : & Block ,
0 commit comments