mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
add detailed metrics for storage layer
This commit is contained in:
parent
e2085d8b21
commit
0443547147
@ -8,4 +8,6 @@ lazy_static::lazy_static! {
|
||||
pub static ref STORE_PUT_TX: Arc<dyn Timer> = register_timer("log_entry_sync_manager_put_tx_inner");
|
||||
|
||||
pub static ref STORE_PUT_TX_SPEED_IN_BYTES: Arc<dyn Gauge<usize>> = GaugeUsize::register("log_entry_sync_manager_put_tx_speed_in_bytes");
|
||||
|
||||
pub static ref FlOW_CONTRACT_ROOT: Arc<dyn Timer> = register_timer("log_manager_flow_contract_root");
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -317,6 +317,7 @@ impl LogStoreWrite for LogManager {
|
||||
}
|
||||
|
||||
fn finalize_tx_with_hash(&self, tx_seq: u64, tx_hash: H256) -> crate::error::Result<bool> {
|
||||
let start_time = Instant::now();
|
||||
trace!(
|
||||
"finalize_tx_with_hash: tx_seq={} tx_hash={:?}",
|
||||
tx_seq,
|
||||
@ -345,6 +346,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)
|
||||
|
@ -34,4 +34,6 @@ lazy_static::lazy_static! {
|
||||
register_timer("log_store_flow_store_put_entry_batch_list");
|
||||
|
||||
pub static ref APPEND_ENTRIES: Arc<dyn Timer> = register_timer("log_store_flow_store_append_entries");
|
||||
|
||||
pub static ref FINALIZE_TX_WITH_HASH: Arc<dyn Timer> = register_timer("log_store_log_manager_finalize_tx_with_hash");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user