mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add more pool maintain metrics (#5590)
This commit is contained in:
@ -127,8 +127,10 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
|
||||
// dirty accounts and correct if the pool drifted from current state, for example after
|
||||
// restart or a pipeline run
|
||||
if maintained_state.is_drifted() {
|
||||
metrics.inc_drift();
|
||||
// assuming all senders are dirty
|
||||
dirty_addresses = pool.unique_senders();
|
||||
// make sure we toggle the state back to in sync
|
||||
maintained_state = MaintainedPoolState::InSync;
|
||||
}
|
||||
|
||||
@ -170,6 +172,7 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
|
||||
match blob_store_tracker.on_finalized_block(finalized) {
|
||||
BlobStoreUpdates::None => {}
|
||||
BlobStoreUpdates::Finalized(blobs) => {
|
||||
metrics.inc_deleted_tracked_blobs(blobs.len());
|
||||
// remove all finalized blobs from the blob store
|
||||
pool.delete_blobs(blobs);
|
||||
}
|
||||
@ -442,7 +445,7 @@ impl FinalizedBlockTracker {
|
||||
|
||||
/// Keeps track of the pool's state, whether the accounts in the pool are in sync with the actual
|
||||
/// state.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
enum MaintainedPoolState {
|
||||
/// Pool is assumed to be in sync with the current state
|
||||
InSync,
|
||||
@ -452,6 +455,7 @@ enum MaintainedPoolState {
|
||||
|
||||
impl MaintainedPoolState {
|
||||
/// Returns `true` if the pool is assumed to be out of sync with the current state.
|
||||
#[inline]
|
||||
fn is_drifted(&self) -> bool {
|
||||
matches!(self, MaintainedPoolState::Drifted)
|
||||
}
|
||||
|
||||
@ -59,8 +59,12 @@ pub struct MaintainPoolMetrics {
|
||||
/// Number of currently dirty addresses that need to be updated in the pool by fetching account
|
||||
/// info
|
||||
pub(crate) dirty_accounts: Gauge,
|
||||
/// How often the pool drifted from the canonical state.
|
||||
pub(crate) drift_count: Counter,
|
||||
/// Number of transaction reinserted into the pool after reorg.
|
||||
pub(crate) reinserted_transactions: Counter,
|
||||
/// Number of transactions finalized blob transactions we were tracking.
|
||||
pub(crate) deleted_tracked_finalized_blobs: Counter,
|
||||
}
|
||||
|
||||
impl MaintainPoolMetrics {
|
||||
@ -73,4 +77,14 @@ impl MaintainPoolMetrics {
|
||||
pub(crate) fn inc_reinserted_transactions(&self, count: usize) {
|
||||
self.reinserted_transactions.increment(count as u64);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn inc_deleted_tracked_blobs(&self, count: usize) {
|
||||
self.deleted_tracked_finalized_blobs.increment(count as u64);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn inc_drift(&self) {
|
||||
self.drift_count.increment(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user