chore: add pending imports metrics (#3344)

This commit is contained in:
Matthias Seitz
2023-06-22 20:53:47 +02:00
committed by GitHub
parent d7467e86b4
commit 3390671cb6
2 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,8 @@ pub struct TransactionsManagerMetrics {
pub(crate) messages_with_already_seen_hashes: Counter,
/// Total number of messages with already seen full transactions
pub(crate) messages_with_already_seen_transactions: Counter,
/// Number of transactions about to be imported into the pool.
pub(crate) pending_pool_imports: Gauge,
}
/// Metrics for Disconnection types

View File

@ -158,6 +158,10 @@ where
TransactionsHandle { manager_tx: self.command_tx.clone() }
}
fn update_import_metrics(&self) {
self.metrics.pending_pool_imports.set(self.pool_imports.len() as f64);
}
/// Request handler for an incoming request for transactions
fn on_get_pooled_transactions(
&mut self,
@ -538,6 +542,8 @@ where
}
}
this.update_import_metrics();
// Advance all imports
while let Poll::Ready(Some(import_res)) = this.pool_imports.poll_next_unpin(cx) {
match import_res {
@ -558,6 +564,8 @@ where
}
}
this.update_import_metrics();
// handle and propagate new transactions
let mut new_txs = Vec::new();
while let Poll::Ready(Some(hash)) = this.pending_transactions.poll_next_unpin(cx) {