mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-06 16:03:08 +00:00
chore: add waku_connected_peers_per_shard
This commit is contained in:
parent
fbfad1ff60
commit
54387c0931
@ -15,7 +15,7 @@ import ../node/peer_manager/peer_manager, ../waku_core, ../waku_enr
|
||||
export protocol, waku_enr
|
||||
|
||||
declarePublicGauge waku_discv5_discovered,
|
||||
"number of nodes discovered", labels = ["shard"]
|
||||
"number of nodes discovered by each shard", labels = ["shard"]
|
||||
declarePublicGauge waku_discv5_errors, "number of waku discv5 errors", ["type"]
|
||||
|
||||
logScope:
|
||||
|
||||
@ -34,6 +34,9 @@ declarePublicGauge waku_peers_errors, "Number of peer manager errors", ["type"]
|
||||
declarePublicGauge waku_connected_peers,
|
||||
"Number of physical connections per direction and protocol",
|
||||
labels = ["direction", "protocol"]
|
||||
declarePublicGauge waku_connected_peers_per_shard,
|
||||
"Number of physical connections per shard",
|
||||
labels = ["shard"]
|
||||
declarePublicGauge waku_streams_peers,
|
||||
"Number of streams per direction and protocol", labels = ["direction", "protocol"]
|
||||
declarePublicGauge waku_peer_store_size, "Number of peers managed by the peer store"
|
||||
@ -809,6 +812,15 @@ proc logAndMetrics(pm: PeerManager) {.async.} =
|
||||
protoStreamsOut.float64, labelValues = [$Direction.Out, proto]
|
||||
)
|
||||
|
||||
for shard in 0..63: # Assuming shards are 0-63 as per Waku spec
|
||||
waku_connected_peers_per_shard.set(0.0, labelValues = [$shard])
|
||||
|
||||
for shard in pm.wakuMetadata.shards.items:
|
||||
let connectedPeers = peerStore.getPeersByShard(uint16(pm.wakuMetadata.clusterId), uint16(shard))
|
||||
waku_connected_peers_per_shard.set(
|
||||
connectedPeers.len.float64, labelValues = [$shard]
|
||||
)
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Pruning and Maintenance (Stale Peers Management) #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user