mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 03:30:38 +00:00
Add metrics for subnet queries (#3721)
## Issue Addressed N/A ## Proposed Changes Add metrics for peers discovered in subnet discv5 queries.
This commit is contained in:
parent
713b6a18d4
commit
857ef25d28
@ -834,6 +834,17 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
|
||||
|
||||
// Map each subnet query's min_ttl to the set of ENR's returned for that subnet.
|
||||
queries.iter().for_each(|query| {
|
||||
let query_str = match query.subnet {
|
||||
Subnet::Attestation(_) => "attestation",
|
||||
Subnet::SyncCommittee(_) => "sync_committee",
|
||||
};
|
||||
|
||||
if let Some(v) = metrics::get_int_counter(
|
||||
&metrics::TOTAL_SUBNET_QUERIES,
|
||||
&[query_str],
|
||||
) {
|
||||
v.inc();
|
||||
}
|
||||
// A subnet query has completed. Add back to the queue, incrementing retries.
|
||||
self.add_subnet_query(query.subnet, query.min_ttl, query.retries + 1);
|
||||
|
||||
@ -845,6 +856,12 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
|
||||
.filter(|enr| subnet_predicate(enr))
|
||||
.map(|enr| enr.peer_id())
|
||||
.for_each(|peer_id| {
|
||||
if let Some(v) = metrics::get_int_counter(
|
||||
&metrics::SUBNET_PEERS_FOUND,
|
||||
&[query_str],
|
||||
) {
|
||||
v.inc();
|
||||
}
|
||||
let other_min_ttl = mapped_results.get_mut(&peer_id);
|
||||
|
||||
// map peer IDs to the min_ttl furthest in the future
|
||||
|
@ -112,6 +112,19 @@ lazy_static! {
|
||||
&["client"]
|
||||
);
|
||||
|
||||
pub static ref SUBNET_PEERS_FOUND: Result<IntCounterVec> =
|
||||
try_create_int_counter_vec(
|
||||
"discovery_query_peers_found",
|
||||
"Total number of peers found in attestation subnets and sync subnets",
|
||||
&["type"]
|
||||
);
|
||||
pub static ref TOTAL_SUBNET_QUERIES: Result<IntCounterVec> =
|
||||
try_create_int_counter_vec(
|
||||
"discovery_total_queries",
|
||||
"Total number of discovery subnet queries",
|
||||
&["type"]
|
||||
);
|
||||
|
||||
/*
|
||||
* Inbound/Outbound peers
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user