@@ -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 } ,
@@ -391,6 +392,9 @@ where
391392 self . context ( ) . extra ( ) . chain_id ( )
392393 }
393394
395+ #[ instrument( target = "telemetry_only" , skip_all, fields(
396+ chain_id = %self . chain_id( ) ,
397+ ) ) ]
394398 pub async fn query_application (
395399 & mut self ,
396400 local_time : Timestamp ,
@@ -408,6 +412,10 @@ where
408412 . with_execution_context ( ChainExecutionContext :: Query )
409413 }
410414
415+ #[ instrument( target = "telemetry_only" , skip_all, fields(
416+ chain_id = %self . chain_id( ) ,
417+ application_id = %application_id
418+ ) ) ]
411419 pub async fn describe_application (
412420 & mut self ,
413421 application_id : ApplicationId ,
@@ -419,6 +427,11 @@ where
419427 . with_execution_context ( ChainExecutionContext :: DescribeApplication )
420428 }
421429
430+ #[ instrument( target = "telemetry_only" , skip_all, fields(
431+ chain_id = %self . chain_id( ) ,
432+ target = %target,
433+ height = %height
434+ ) ) ]
422435 pub async fn mark_messages_as_received (
423436 & mut self ,
424437 target : & ChainId ,
@@ -506,6 +519,9 @@ where
506519
507520 /// Verifies that this chain is up-to-date and all the messages executed ahead of time
508521 /// have been properly received by now.
522+ #[ instrument( target = "telemetry_only" , skip_all, fields(
523+ chain_id = %self . chain_id( )
524+ ) ) ]
509525 pub async fn validate_incoming_bundles ( & self ) -> Result < ( ) , ChainError > {
510526 let chain_id = self . chain_id ( ) ;
511527 let pairs = self . inboxes . try_load_all_entries ( ) . await ?;
@@ -567,6 +583,11 @@ where
567583 /// round timeouts.
568584 ///
569585 /// Returns `true` if incoming `Subscribe` messages created new outbox entries.
586+ #[ instrument( target = "telemetry_only" , skip_all, fields(
587+ chain_id = %self . chain_id( ) ,
588+ origin = %origin,
589+ bundle_height = %bundle. height
590+ ) ) ]
570591 pub async fn receive_message_bundle (
571592 & mut self ,
572593 origin : & ChainId ,
@@ -661,6 +682,9 @@ where
661682 }
662683
663684 /// Removes the incoming message bundles in the block from the inboxes.
685+ #[ instrument( target = "telemetry_only" , skip_all, fields(
686+ chain_id = %self . chain_id( ) ,
687+ ) ) ]
664688 pub async fn remove_bundles_from_inboxes (
665689 & mut self ,
666690 timestamp : Timestamp ,
@@ -750,6 +774,10 @@ where
750774
751775 /// Executes a block: first the incoming messages, then the main operation.
752776 /// Does not update chain state other than the execution state.
777+ #[ instrument( target = "telemetry_only" , skip_all, fields(
778+ chain_id = %block. chain_id,
779+ block_height = %block. height
780+ ) ) ]
753781 #[ expect( clippy:: too_many_arguments) ]
754782 async fn execute_block_inner (
755783 chain : & mut ExecutionStateView < C > ,
@@ -859,6 +887,10 @@ where
859887
860888 /// Executes a block: first the incoming messages, then the main operation.
861889 /// Does not update chain state other than the execution state.
890+ #[ instrument( target = "telemetry_only" , skip_all, fields(
891+ chain_id = %self . chain_id( ) ,
892+ block_height = %block. height
893+ ) ) ]
862894 pub async fn execute_block (
863895 & mut self ,
864896 block : & ProposedBlock ,
@@ -919,6 +951,10 @@ where
919951 /// Applies an execution outcome to the chain, updating the outboxes, state hash and chain
920952 /// manager. This does not touch the execution state itself, which must be updated separately.
921953 /// Returns the set of event streams that were updated as a result of applying the block.
954+ #[ instrument( target = "telemetry_only" , skip_all, fields(
955+ chain_id = %self . chain_id( ) ,
956+ block_height = %block. inner( ) . inner( ) . header. height
957+ ) ) ]
922958 pub async fn apply_confirmed_block (
923959 & mut self ,
924960 block : & ConfirmedBlock ,
@@ -953,6 +989,10 @@ where
953989
954990 /// Adds a block to `preprocessed_blocks`, and updates the outboxes where possible.
955991 /// Returns the set of streams that were updated as a result of preprocessing the block.
992+ #[ instrument( target = "telemetry_only" , skip_all, fields(
993+ chain_id = %self . chain_id( ) ,
994+ block_height = %block. inner( ) . inner( ) . header. height
995+ ) ) ]
956996 pub async fn preprocess_block (
957997 & mut self ,
958998 block : & ConfirmedBlock ,
@@ -979,6 +1019,10 @@ where
9791019 }
9801020
9811021 /// Verifies that the block is valid according to the chain's application permission settings.
1022+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1023+ block_height = %block. height,
1024+ num_transactions = %block. transactions. len( )
1025+ ) ) ]
9821026 fn check_app_permissions (
9831027 app_permissions : & ApplicationPermissions ,
9841028 block : & ProposedBlock ,
@@ -1021,6 +1065,10 @@ where
10211065 }
10221066
10231067 /// Returns the hashes of all blocks we have in the given range.
1068+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1069+ chain_id = %self . chain_id( ) ,
1070+ next_block_height = %self . tip_state. get( ) . next_block_height
1071+ ) ) ]
10241072 pub async fn block_hashes (
10251073 & self ,
10261074 range : impl RangeBounds < BlockHeight > ,
@@ -1066,6 +1114,10 @@ where
10661114 /// Updates the outboxes with the messages sent in the block.
10671115 ///
10681116 /// Returns the set of all recipients.
1117+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1118+ chain_id = %self . chain_id( ) ,
1119+ block_height = %block. header. height
1120+ ) ) ]
10691121 async fn process_outgoing_messages (
10701122 & mut self ,
10711123 block : & Block ,
@@ -1157,6 +1209,10 @@ where
11571209 /// Updates the event streams with events emitted by the block if they form a contiguous
11581210 /// sequence (might not be the case when preprocessing a block).
11591211 /// Returns the set of updated event streams.
1212+ #[ instrument( target = "telemetry_only" , skip_all, fields(
1213+ chain_id = %self . chain_id( ) ,
1214+ block_height = %block. header. height
1215+ ) ) ]
11601216 async fn process_emitted_events (
11611217 & mut self ,
11621218 block : & Block ,
0 commit comments