add more metrics

This commit is contained in:
Peter Zhang 2024-11-21 12:38:57 +08:00
parent 3bd7869474
commit aaa4ced0cc
2 changed files with 10 additions and 1 deletions

View File

@ -285,7 +285,10 @@ impl FlowWrite for FlowStore {
} }
fn put_pad_data(&self, data_sizes: &[PadPair], tx_seq: u64) -> crate::error::Result<()> { fn put_pad_data(&self, data_sizes: &[PadPair], tx_seq: u64) -> crate::error::Result<()> {
self.flow_db.put_pad_data(data_sizes, tx_seq) let start_time = Instant::now();
let res = self.flow_db.put_pad_data(data_sizes, tx_seq);
metrics::PUT_PAD_DATA.update_since(start_time);
res
} }
fn put_pad_data_sync_height(&self, sync_index: u64) -> crate::error::Result<()> { fn put_pad_data_sync_height(&self, sync_index: u64) -> crate::error::Result<()> {
@ -295,6 +298,7 @@ impl FlowWrite for FlowStore {
impl FlowSeal for FlowStore { impl FlowSeal for FlowStore {
fn pull_seal_chunk(&self, seal_index_max: usize) -> Result<Option<Vec<SealTask>>> { fn pull_seal_chunk(&self, seal_index_max: usize) -> Result<Option<Vec<SealTask>>> {
let start_time = Instant::now();
let to_seal_set = self.seal_manager.to_seal_set.read(); let to_seal_set = self.seal_manager.to_seal_set.read();
self.seal_manager.update_pull_time(); self.seal_manager.update_pull_time();
@ -327,6 +331,8 @@ impl FlowSeal for FlowStore {
}) })
} }
metrics::PULL_SEAL_CHUNK.update_since(start_time);
Ok(Some(tasks)) Ok(Some(tasks))
} }

View File

@ -40,4 +40,7 @@ lazy_static::lazy_static! {
pub static ref DATA_TO_MERKLE_LEAVES_SIZE: Arc<dyn Gauge<usize>> = GaugeUsize::register("log_store_data_to_merkle_leaves_size"); pub static ref DATA_TO_MERKLE_LEAVES_SIZE: Arc<dyn Gauge<usize>> = GaugeUsize::register("log_store_data_to_merkle_leaves_size");
pub static ref TX_BY_SEQ_NUMBER: Arc<dyn Timer> = register_timer("log_store_tx_store_get_tx_by_seq_number"); pub static ref TX_BY_SEQ_NUMBER: Arc<dyn Timer> = register_timer("log_store_tx_store_get_tx_by_seq_number");
pub static ref PULL_SEAL_CHUNK: Arc<dyn Timer> = register_timer("log_store_flow_store_pull_seal_chunks");
pub static ref PUT_PAD_DATA: Arc<dyn Timer> = register_timer("log_store_flow_store_put_pad_data");
} }