From 8ab220ac00112517977ee2f91071da45c406a4c3 Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 12 Jan 2023 23:28:09 -0600 Subject: [PATCH] Fix peer count by client metric (#4999) --- packages/beacon-node/src/network/peers/peerManager.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/beacon-node/src/network/peers/peerManager.ts b/packages/beacon-node/src/network/peers/peerManager.ts index 88dfd1572d7..2c2d6e7e887 100644 --- a/packages/beacon-node/src/network/peers/peerManager.ts +++ b/packages/beacon-node/src/network/peers/peerManager.ts @@ -620,6 +620,11 @@ export class PeerManager { metrics.peerLongLivedAttnets.reset(); metrics.peerConnectionLength.reset(); + // reset client counts _for each client_ to 0 + for (const client of Object.values(ClientKind)) { + peersByClient.set(client, 0); + } + for (const connections of getConnectionsMap(this.libp2p.connectionManager).values()) { const openCnx = connections.find((cnx) => cnx.stat.status === "OPEN"); if (openCnx) {