Skip to content

Commit

Permalink
Merge branch 'importer-component' of https://github.com/cloudwalk/str…
Browse files Browse the repository at this point in the history
…atus into importer-component
  • Loading branch information
gabriel-aranha-cw committed Jul 26, 2024
2 parents b682c62 + 79f66a8 commit 49aedae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/eth/rpc/rpc_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl RpcSubscriptions {
{
metrics::set_rpc_subscriptions_active(subs.pending_txs.read().await.len() as u64, label::PENDING_TXS);
metrics::set_rpc_subscriptions_active(subs.new_heads.read().await.len() as u64, label::NEW_HEADS);
metrics::set_rpc_subscriptions_active(subs.logs.read().await.len() as u64, label::LOGS);
RpcSubscriptionsConnected::set_log_subs_metric(&(*subs.logs.read().await));
}

// await next iteration
Expand Down Expand Up @@ -402,6 +402,12 @@ impl RpcSubscriptionsConnected {
filter_to_subscription_map.insert(filter.clone(), SubscriptionWithFilter::new(inner, filter));

#[cfg(feature = "metrics")]
metrics::set_rpc_subscriptions_active(subs.len() as u64, label::LOGS);
Self::set_log_subs_metric(&subs);
}

#[cfg(feature = "metrics")]
fn set_log_subs_metric(log_subs: &HashMap<ConnectionId, HashMap<LogFilter, SubscriptionWithFilter>>) {
let sub_count: usize = log_subs.values().map(|value| value.len()).sum();
metrics::set_rpc_subscriptions_active(sub_count as u64, label::LOGS);
}
}

0 comments on commit 49aedae

Please sign in to comment.