@@ -23,6 +23,7 @@ use crate::event_handler::{Error, EventHandler};
23
23
use crate :: fetcher:: { EventsFetcher , LastFinalizedBlockNumFetcher } ;
24
24
use crate :: sync_checkpoint_repository:: { Checkpoint , CheckpointRepository } ;
25
25
use executor_primitives:: GetEventId ;
26
+ use metrics:: { describe_gauge, gauge} ;
26
27
27
28
/// Component, used to listen to chain and execute requested intents
28
29
/// Requires specific implementations of:
65
66
stop_signal : Receiver < ( ) > ,
66
67
last_processed_log_repository : CheckpointRepositoryT ,
67
68
) -> Result < Self , ( ) > {
69
+ describe_gauge ! ( synced_block_gauge_name( id) , "Last synced block" ) ;
68
70
Ok ( Self {
69
71
id : id. to_string ( ) ,
70
72
handle,
@@ -185,6 +187,7 @@ impl<
185
187
self . checkpoint_repository
186
188
. save ( CheckpointT :: from ( block_number_to_sync) )
187
189
. expect ( "Could not save checkpoint" ) ;
190
+ gauge ! ( synced_block_gauge_name( & self . id) ) . set ( block_number_to_sync as f64 ) ;
188
191
log:: debug!( "Finished syncing block: {}" , block_number_to_sync) ;
189
192
block_number_to_sync += 1 ;
190
193
} ,
@@ -205,3 +208,7 @@ impl<
205
208
}
206
209
}
207
210
}
211
+
212
+ fn synced_block_gauge_name ( listener_id : & str ) -> String {
213
+ format ! ( "{}_synced_block" , listener_id)
214
+ }
0 commit comments