mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 11:52:42 +00:00
Add interop metrics (#2645)
## Issue Addressed Resolves: #2644 ## Proposed Changes - Adds mandatory metrics mentioned here: https://github.com/ethereum/beacon-metrics/blob/master/metrics.md#interop-metrics ## Additional Info Couldn't figure out how to alias metrics, so I created them all as new gauges/counters. Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -9,6 +9,8 @@ lazy_static! {
|
||||
"libp2p_peer_connected_peers_total",
|
||||
"Count of libp2p peers currently connected"
|
||||
);
|
||||
pub static ref PEERS_CONNECTED_INTEROP: Result<IntGauge> =
|
||||
try_create_int_gauge("libp2p_peers", "Count of libp2p peers currently connected");
|
||||
pub static ref PEER_CONNECT_EVENT_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"libp2p_peer_connect_event_total",
|
||||
"Count of libp2p peer connect events (not the current number of connected peers)"
|
||||
|
||||
@@ -401,12 +401,12 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
}
|
||||
}
|
||||
|
||||
let connected_peers = self.network_globals.connected_peers() as i64;
|
||||
|
||||
// increment prometheus metrics
|
||||
metrics::inc_counter(&metrics::PEER_CONNECT_EVENT_COUNT);
|
||||
metrics::set_gauge(
|
||||
&metrics::PEERS_CONNECTED,
|
||||
self.network_globals.connected_peers() as i64,
|
||||
);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED, connected_peers);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED_INTEROP, connected_peers);
|
||||
}
|
||||
|
||||
pub fn inject_connection_closed(
|
||||
@@ -456,12 +456,12 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
// reference so that peer manager can track this peer.
|
||||
self.inject_disconnect(&peer_id);
|
||||
|
||||
let connected_peers = self.network_globals.connected_peers() as i64;
|
||||
|
||||
// Update the prometheus metrics
|
||||
metrics::inc_counter(&metrics::PEER_DISCONNECT_EVENT_COUNT);
|
||||
metrics::set_gauge(
|
||||
&metrics::PEERS_CONNECTED,
|
||||
self.network_globals.connected_peers() as i64,
|
||||
);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED, connected_peers);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED_INTEROP, connected_peers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,12 +866,12 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
// start a ping and status timer for the peer
|
||||
self.status_peers.insert(*peer_id);
|
||||
|
||||
let connected_peers = self.network_globals.connected_peers() as i64;
|
||||
|
||||
// increment prometheus metrics
|
||||
metrics::inc_counter(&metrics::PEER_CONNECT_EVENT_COUNT);
|
||||
metrics::set_gauge(
|
||||
&metrics::PEERS_CONNECTED,
|
||||
self.network_globals.connected_peers() as i64,
|
||||
);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED, connected_peers);
|
||||
metrics::set_gauge(&metrics::PEERS_CONNECTED_INTEROP, connected_peers);
|
||||
|
||||
// Increment the PEERS_PER_CLIENT metric
|
||||
if let Some(kind) = self
|
||||
|
||||
Reference in New Issue
Block a user