mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add metrics for inflight get pooled tx requests (#4547)
This commit is contained in:
@ -67,6 +67,8 @@ pub struct TransactionsManagerMetrics {
|
||||
pub(crate) messages_with_already_seen_transactions: Counter,
|
||||
/// Number of transactions about to be imported into the pool.
|
||||
pub(crate) pending_pool_imports: Gauge,
|
||||
/// Currently active outgoing GetPooledTransactions requests.
|
||||
pub(crate) inflight_transaction_requests: Gauge,
|
||||
/// How often we failed to send a request to the peer because the channel was full.
|
||||
pub(crate) egress_peer_channel_full: Counter,
|
||||
}
|
||||
|
||||
@ -174,10 +174,16 @@ where
|
||||
TransactionsHandle { manager_tx: self.command_tx.clone() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn update_import_metrics(&self) {
|
||||
self.metrics.pending_pool_imports.set(self.pool_imports.len() as f64);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn update_request_metrics(&self) {
|
||||
self.metrics.inflight_transaction_requests.set(self.inflight_requests.len() as f64);
|
||||
}
|
||||
|
||||
/// Request handler for an incoming request for transactions
|
||||
fn on_get_pooled_transactions(
|
||||
&mut self,
|
||||
@ -591,6 +597,8 @@ where
|
||||
this.on_network_tx_event(event);
|
||||
}
|
||||
|
||||
this.update_request_metrics();
|
||||
|
||||
// Advance all requests.
|
||||
while let Poll::Ready(Some(GetPooledTxResponse { peer_id, result })) =
|
||||
this.inflight_requests.poll_next_unpin(cx)
|
||||
@ -609,6 +617,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
this.update_request_metrics();
|
||||
this.update_import_metrics();
|
||||
|
||||
// Advance all imports
|
||||
|
||||
Reference in New Issue
Block a user