mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-17 23:36:34 +00:00
add metric
This commit is contained in:
parent
a10b8af737
commit
0d0ef3519f
@ -34,6 +34,9 @@ when defined(libp2p_expensive_metrics):
|
||||
declareGauge(libp2p_gossipsub_priority_queue_size, "the number of messages in the priority queue", labels = ["id"])
|
||||
declareGauge(libp2p_gossipsub_non_priority_queue_size, "the number of messages in the non-priority queue", labels = ["id"])
|
||||
|
||||
declareCounter(libp2p_gossipsub_non_priority_msgs_dropped, "the number of dropped messages in the non-priority queue", labels = ["id"])
|
||||
|
||||
|
||||
type
|
||||
PeerRateLimitError* = object of CatchableError
|
||||
|
||||
@ -393,6 +396,8 @@ proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
|
||||
when defined(libp2p_expensive_metrics):
|
||||
libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId])
|
||||
if Moment.now() - ttlMsg.ttl >= p.rpcmessagequeue.maxDurationInNonPriorityQueue:
|
||||
when defined(libp2p_expensive_metrics):
|
||||
libp2p_gossipsub_non_priority_msgs_dropped.inc(labelValues = [$p.peerId])
|
||||
continue
|
||||
await p.sendMsg(ttlMsg.msg)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user