@@ -261,7 +261,13 @@ async fn changes_in_block_call(
261261 }
262262 } ) ?;
263263
264- let result = fetch_changes_in_block ( & data, cache_block, & params. block_reference ) . await ;
264+ let result = fetch_changes_in_block (
265+ & data,
266+ cache_block,
267+ & params. block_reference ,
268+ "EXPERIMENTAL_changes_in_block" ,
269+ )
270+ . await ;
265271 #[ cfg( feature = "shadow-data-consistency" ) ]
266272 {
267273 if let near_primitives:: types:: BlockReference :: Finality ( _) = params. block_reference {
@@ -306,6 +312,7 @@ async fn changes_in_block_by_type_call(
306312 cache_block,
307313 & params. state_changes_request ,
308314 & params. block_reference ,
315+ "EXPERIMENTAL_changes" ,
309316 )
310317 . await ;
311318
@@ -367,6 +374,9 @@ pub async fn fetch_block(
367374 return match finality {
368375 near_primitives:: types:: Finality :: Final
369376 | near_primitives:: types:: Finality :: DoomSlug => {
377+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
378+ . with_label_values ( & [ method_name, "cache" ] )
379+ . inc ( ) ;
370380 let block_view = data. blocks_info_by_finality . final_block_view ( ) . await ;
371381 Ok ( near_jsonrpc:: primitives:: types:: blocks:: RpcBlockResponse { block_view } )
372382 }
@@ -379,6 +389,9 @@ pub async fn fetch_block(
379389 } ,
380390 )
381391 } else {
392+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
393+ . with_label_values ( & [ method_name, "cache" ] )
394+ . inc ( ) ;
382395 let block_view = data. blocks_info_by_finality . optimistic_block_view ( ) . await ;
383396 Ok (
384397 near_jsonrpc:: primitives:: types:: blocks:: RpcBlockResponse {
@@ -402,6 +415,9 @@ pub async fn fetch_block(
402415 . await
403416 . block_height
404417 {
418+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
419+ . with_label_values ( & [ method_name, "cache" ] )
420+ . inc ( ) ;
405421 data. blocks_info_by_finality . final_block_view ( ) . await
406422 } else if block_height
407423 == data
@@ -410,8 +426,14 @@ pub async fn fetch_block(
410426 . await
411427 . block_height
412428 {
429+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
430+ . with_label_values ( & [ method_name, "cache" ] )
431+ . inc ( ) ;
413432 data. blocks_info_by_finality . optimistic_block_view ( ) . await
414433 } else {
434+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
435+ . with_label_values ( & [ method_name, "lake" ] )
436+ . inc ( ) ;
415437 near_lake_framework:: fastnear:: fetchers:: fetch_block_or_retry (
416438 & data. fastnear_client ,
417439 block_height,
@@ -484,6 +506,9 @@ pub async fn fetch_chunk(
484506 )
485507 . map ( |block_height_shard_id| ( block_height_shard_id. 0 , block_height_shard_id. 1 ) ) ?,
486508 } ;
509+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
510+ . with_label_values ( & [ method_name, "lake" ] )
511+ . inc ( ) ;
487512 let chunk_view =
488513 fetch_chunk_from_fastnear ( & data. fastnear_client , block_height, shard_id. into ( ) ) . await ?;
489514 // increase block category metrics
@@ -505,11 +530,12 @@ async fn fetch_changes_in_block(
505530 data : & Data < ServerContext > ,
506531 cache_block : crate :: modules:: blocks:: CacheBlock ,
507532 block_reference : & near_primitives:: types:: BlockReference ,
533+ method_name : & str ,
508534) -> Result <
509535 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesInBlockByTypeResponse ,
510536 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesError ,
511537> {
512- let trie_keys = fetch_state_changes ( data, cache_block, block_reference)
538+ let trie_keys = fetch_state_changes ( data, cache_block, block_reference, method_name )
513539 . await
514540 . map_err ( |err| {
515541 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesError :: UnknownBlock {
@@ -593,11 +619,12 @@ async fn fetch_changes_in_block_by_type(
593619 cache_block : crate :: modules:: blocks:: CacheBlock ,
594620 state_changes_request : & near_primitives:: views:: StateChangesRequestView ,
595621 block_reference : & near_primitives:: types:: BlockReference ,
622+ method_name : & str ,
596623) -> Result <
597624 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesInBlockResponse ,
598625 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesError ,
599626> {
600- let changes = fetch_state_changes ( data, cache_block, block_reference)
627+ let changes = fetch_state_changes ( data, cache_block, block_reference, method_name )
601628 . await
602629 . map_err ( |err| {
603630 near_jsonrpc:: primitives:: types:: changes:: RpcStateChangesError :: UnknownBlock {
@@ -624,6 +651,7 @@ async fn fetch_state_changes(
624651 data : & Data < ServerContext > ,
625652 cache_block : crate :: modules:: blocks:: CacheBlock ,
626653 block_reference : & near_primitives:: types:: BlockReference ,
654+ method_name : & str ,
627655) -> anyhow:: Result < near_primitives:: views:: StateChangesView > {
628656 if let near_primitives:: types:: BlockReference :: Finality ( finality) = block_reference {
629657 match finality {
@@ -645,7 +673,7 @@ async fn fetch_state_changes(
645673 }
646674 }
647675 } else {
648- Ok ( fetch_shards_by_cache_block ( data, cache_block)
676+ Ok ( fetch_shards_by_cache_block ( data, cache_block, method_name )
649677 . await ?
650678 . into_iter ( )
651679 . flat_map ( |shard| shard. state_changes )
@@ -658,7 +686,11 @@ async fn fetch_state_changes(
658686async fn fetch_shards_by_cache_block (
659687 data : & Data < ServerContext > ,
660688 cache_block : crate :: modules:: blocks:: CacheBlock ,
689+ method_name : & str ,
661690) -> anyhow:: Result < Vec < near_indexer_primitives:: IndexerShard > > {
691+ crate :: metrics:: REQUESTS_BLOCKS_COUNTERS
692+ . with_label_values ( & [ method_name, "lake" ] )
693+ . inc ( ) ;
662694 match near_lake_framework:: fastnear:: fetchers:: fetch_streamer_message (
663695 & data. fastnear_client ,
664696 cache_block. block_height ,
0 commit comments