Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add logging for RPC subscription notifications #2021

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/eth/rpc/rpc_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ impl RpcSubscriptions {

let interested_subs = subs.pending_txs.read().await;
let interested_subs = interested_subs.values().collect_vec();

tracing::info!(
tx_hash = ?tx_hash,
subscribers_count = interested_subs.len(),
"notifying subscribers about new pending transaction"
);

Self::notify(interested_subs, tx_hash.to_string());
}
warn_task_rx_closed(TASK_NAME);
Expand All @@ -196,6 +203,14 @@ impl RpcSubscriptions {

let interested_subs = subs.new_heads.read().await;
let interested_subs = interested_subs.values().collect_vec();

tracing::info!(
block_number = ?block_header.number,
block_hash = ?block_header.hash,
subscribers_count = interested_subs.len(),
"notifying subscribers about new block"
);

Self::notify(interested_subs, block_header);
}
warn_task_rx_closed(TASK_NAME);
Expand Down Expand Up @@ -225,6 +240,13 @@ impl RpcSubscriptions {
.filter_map(|s| if_else!(s.filter.matches(&log), Some(&s.inner), None))
.collect_vec();

tracing::info!(
log_block_number = ?log.block_number,
log_tx_hash = ?log.transaction_hash,
subscribers_count = interested_subs.len(),
"notifying subscribers about new logs"
);

Self::notify(interested_subs, log);
}
warn_task_rx_closed(TASK_NAME);
Expand Down
Loading