diff --git a/node/log_entry_sync/src/sync_manager/metrics.rs b/node/log_entry_sync/src/sync_manager/metrics.rs index 6634065..4409cc7 100644 --- a/node/log_entry_sync/src/sync_manager/metrics.rs +++ b/node/log_entry_sync/src/sync_manager/metrics.rs @@ -8,4 +8,6 @@ lazy_static::lazy_static! { pub static ref STORE_PUT_TX: Arc = register_timer("log_entry_sync_manager_put_tx_inner"); pub static ref STORE_PUT_TX_SPEED_IN_BYTES: Arc> = GaugeUsize::register("log_entry_sync_manager_put_tx_speed_in_bytes"); + + pub static ref FlOW_CONTRACT_ROOT: Arc = register_timer("log_manager_flow_contract_root"); } diff --git a/node/log_entry_sync/src/sync_manager/mod.rs b/node/log_entry_sync/src/sync_manager/mod.rs index 189d236..13c7f04 100644 --- a/node/log_entry_sync/src/sync_manager/mod.rs +++ b/node/log_entry_sync/src/sync_manager/mod.rs @@ -517,6 +517,7 @@ impl LogSyncManager { // If the call fails, we won't check the root here and return `true` directly. let flow_contract = self.log_fetcher.flow_contract(); + let flow_time = Instant::now(); match flow_contract .get_flow_root_by_tx_seq(tx.seq.into()) .call() @@ -547,6 +548,7 @@ impl LogSyncManager { warn!(?e, "fail to read the on-chain flow root"); } } + metrics::FlOW_CONTRACT_ROOT.update_since(flow_time); metrics::STORE_PUT_TX_SPEED_IN_BYTES .update((tx.size / start_time.elapsed().as_millis() as u64) as usize); diff --git a/node/storage/src/log_store/log_manager.rs b/node/storage/src/log_store/log_manager.rs index 65bfdf3..1fbd313 100644 --- a/node/storage/src/log_store/log_manager.rs +++ b/node/storage/src/log_store/log_manager.rs @@ -315,6 +315,7 @@ impl LogStoreWrite for LogManager { } fn finalize_tx_with_hash(&self, tx_seq: u64, tx_hash: H256) -> crate::error::Result { + let start_time = Instant::now(); trace!( "finalize_tx_with_hash: tx_seq={} tx_hash={:?}", tx_seq, @@ -343,6 +344,7 @@ impl LogStoreWrite for LogManager { if same_root_seq_list.first() == Some(&tx_seq) { self.copy_tx_and_finalize(tx_seq, same_root_seq_list[1..].to_vec())?; } + metrics::FINALIZE_TX_WITH_HASH.update_since(start_time); Ok(true) } else { bail!("finalize tx hash with data missing: tx_seq={}", tx_seq) diff --git a/node/storage/src/log_store/metrics.rs b/node/storage/src/log_store/metrics.rs index ca05772..55706a3 100644 --- a/node/storage/src/log_store/metrics.rs +++ b/node/storage/src/log_store/metrics.rs @@ -34,4 +34,6 @@ lazy_static::lazy_static! { register_timer("log_store_flow_store_put_entry_batch_list"); pub static ref APPEND_ENTRIES: Arc = register_timer("log_store_flow_store_append_entries"); + + pub static ref FINALIZE_TX_WITH_HASH: Arc = register_timer("log_store_log_manager_finalize_tx_with_hash"); }