Skip to content

Commit 5006b79

Browse files
committed
add metric
1 parent 61a1300 commit 5006b79

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libp2p/protocols/pubsub/pubsubpeer.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ when defined(libp2p_expensive_metrics):
3535
declareGauge(libp2p_gossipsub_priority_queue_size, "the number of messages in the priority queue", labels = ["id"])
3636
declareGauge(libp2p_gossipsub_non_priority_queue_size, "the number of messages in the non-priority queue", labels = ["id"])
3737

38+
declareCounter(libp2p_gossipsub_non_priority_msgs_dropped, "the number of dropped messages in the non-priority queue", labels = ["id"])
39+
40+
3841
type
3942
PeerRateLimitError* = object of CatchableError
4043

@@ -383,6 +386,7 @@ proc sendNonPriorityTask(p: PubSubPeer) {.async.} =
383386
when defined(libp2p_expensive_metrics):
384387
libp2p_gossipsub_non_priority_queue_size.dec(labelValues = [$p.peerId])
385388
if Moment.now() - ttlMsg.ttl >= p.rpcmessagequeue.maxDurationInNonPriorityQueue:
389+
libp2p_gossipsub_non_priority_msgs_dropped.inc(labelValues = [$p.peerId])
386390
continue
387391
await p.sendMsg(ttlMsg.msg)
388392

0 commit comments

Comments
 (0)