mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: add pending imports metrics (#3344)
This commit is contained in:
@ -54,6 +54,8 @@ pub struct TransactionsManagerMetrics {
|
|||||||
pub(crate) messages_with_already_seen_hashes: Counter,
|
pub(crate) messages_with_already_seen_hashes: Counter,
|
||||||
/// Total number of messages with already seen full transactions
|
/// Total number of messages with already seen full transactions
|
||||||
pub(crate) messages_with_already_seen_transactions: Counter,
|
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
|
/// Metrics for Disconnection types
|
||||||
|
|||||||
@ -158,6 +158,10 @@ where
|
|||||||
TransactionsHandle { manager_tx: self.command_tx.clone() }
|
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
|
/// Request handler for an incoming request for transactions
|
||||||
fn on_get_pooled_transactions(
|
fn on_get_pooled_transactions(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -538,6 +542,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.update_import_metrics();
|
||||||
|
|
||||||
// Advance all imports
|
// Advance all imports
|
||||||
while let Poll::Ready(Some(import_res)) = this.pool_imports.poll_next_unpin(cx) {
|
while let Poll::Ready(Some(import_res)) = this.pool_imports.poll_next_unpin(cx) {
|
||||||
match import_res {
|
match import_res {
|
||||||
@ -558,6 +564,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.update_import_metrics();
|
||||||
|
|
||||||
// handle and propagate new transactions
|
// handle and propagate new transactions
|
||||||
let mut new_txs = Vec::new();
|
let mut new_txs = Vec::new();
|
||||||
while let Poll::Ready(Some(hash)) = this.pending_transactions.poll_next_unpin(cx) {
|
while let Poll::Ready(Some(hash)) = this.pending_transactions.poll_next_unpin(cx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user