@@ -208,6 +208,8 @@ impl ExtractorRunner {
208208
209209 runtime. spawn ( async move {
210210 let id = self . extractor . get_id ( ) ;
211+ // Track the number of partials received for the current block != partial_index.
212+ let mut partials_in_block: u32 = 0 ;
211213 loop {
212214 // this is the main info span of an extractor
213215 let loop_span = info_span ! (
@@ -248,6 +250,20 @@ impl ExtractorRunner {
248250 "extractor" => id. name. to_string( )
249251 ) . set( block_number as f64 ) ;
250252
253+ if data. is_partial {
254+ partials_in_block += 1 ;
255+ }
256+
257+ if data. is_last_partial == Some ( true ) || data. partial_index. is_none( ) {
258+ gauge!(
259+ "extractor_partials_per_block" ,
260+ "chain" => id. chain. to_string( ) ,
261+ "extractor" => id. name. to_string( )
262+ )
263+ . set( partials_in_block as f64 ) ;
264+ partials_in_block = 0 ;
265+ }
266+
251267 // Start measuring block processing time
252268 let start_time = std:: time:: Instant :: now( ) ;
253269
@@ -267,16 +283,22 @@ impl ExtractorRunner {
267283 Self :: propagate_msg( & self . subscriptions, msg) . await
268284 }
269285
270- let duration = start_time. elapsed( ) ;
271- let partial_block_index = data. partial_index. unwrap_or( 0 ) ;
286+ let duration_ms = start_time. elapsed( ) . as_millis( ) as f64 ;
287+ let block_type = match ( data. is_partial, data. is_last_partial) {
288+ ( false , _) => "full" ,
289+ ( true , Some ( true ) ) => "final_partial" ,
290+ ( true , _) => "partial" ,
291+ } ;
292+
272293 gauge!(
273294 "block_processing_time_ms" ,
274295 "chain" => id. chain. to_string( ) ,
275296 "extractor" => id. name. to_string( ) ,
276- "partial_block_index " => partial_block_index . to_string ( )
277- ) . set( duration . as_millis ( ) as f64 ) ;
297+ "block_type " => block_type
298+ ) . set( duration_ms ) ;
278299 }
279300 Some ( Ok ( BlockResponse :: Undo ( undo_signal) ) ) => {
301+ partials_in_block = 0 ;
280302 info!( block=?& undo_signal. last_valid_block, "Revert requested!" ) ;
281303 match self . extractor. handle_revert( undo_signal. clone( ) ) . await {
282304 Ok ( Some ( msg) ) => {
@@ -309,8 +331,8 @@ impl ExtractorRunner {
309331 tracing:: Span :: current ( ) . record ( "otel.status_code" , "ok" ) ;
310332 Ok ( true ) // Continue the loop
311333 }
312- . instrument ( loop_span)
313- . await ?;
334+ . instrument ( loop_span)
335+ . await ?;
314336
315337 if !should_continue {
316338 break Ok ( ( ) ) ;
0 commit comments