fix: add back waku discv5 metrics (#2927)

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
This commit is contained in:
Simon-Pierre Vivier 2024-07-26 16:18:14 -04:00 committed by GitHub
parent 08973add7e
commit e4e01fabfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -211,6 +211,8 @@ proc findRandomPeers*(
elif wd.predicate.isSome(): elif wd.predicate.isSome():
discoveredRecords = discoveredRecords.filter(wd.predicate.get()) discoveredRecords = discoveredRecords.filter(wd.predicate.get())
waku_discv5_discovered.inc(discoveredRecords.len)
return discoveredRecords return discoveredRecords
proc searchLoop(wd: WakuDiscoveryV5) {.async.} = proc searchLoop(wd: WakuDiscoveryV5) {.async.} =
@ -233,6 +235,7 @@ proc searchLoop(wd: WakuDiscoveryV5) {.async.} =
let peerInfo = record.toRemotePeerInfo().valueOr: let peerInfo = record.toRemotePeerInfo().valueOr:
## in case of error, we keep track of it for debugging purposes ## in case of error, we keep track of it for debugging purposes
wrongRecordsReasons.add(($record, $error)) wrongRecordsReasons.add(($record, $error))
waku_discv5_errors.inc(labelValues = [$error])
continue continue
discoveredPeers.add(peerInfo) discoveredPeers.add(peerInfo)

View File

@ -36,6 +36,7 @@ declarePublicGauge waku_streams_peers,
declarePublicGauge waku_peer_store_size, "Number of peers managed by the peer store" declarePublicGauge waku_peer_store_size, "Number of peers managed by the peer store"
declarePublicGauge waku_service_peers, declarePublicGauge waku_service_peers,
"Service peer protocol and multiaddress ", labels = ["protocol", "peerId"] "Service peer protocol and multiaddress ", labels = ["protocol", "peerId"]
declarePublicGauge waku_total_unique_peers, "total number of unique peers"
logScope: logScope:
topics = "waku node peer_manager" topics = "waku node peer_manager"
@ -141,6 +142,8 @@ proc addPeer*(
trace "Adding peer to manager", trace "Adding peer to manager",
peerId = remotePeerInfo.peerId, addresses = remotePeerInfo.addrs peerId = remotePeerInfo.peerId, addresses = remotePeerInfo.addrs
waku_total_unique_peers.inc()
pm.peerStore[AddressBook][remotePeerInfo.peerId] = remotePeerInfo.addrs pm.peerStore[AddressBook][remotePeerInfo.peerId] = remotePeerInfo.addrs
pm.peerStore[KeyBook][remotePeerInfo.peerId] = remotePeerInfo.publicKey pm.peerStore[KeyBook][remotePeerInfo.peerId] = remotePeerInfo.publicKey
pm.peerStore[SourceBook][remotePeerInfo.peerId] = origin pm.peerStore[SourceBook][remotePeerInfo.peerId] = origin