chore: add waku_rln_messages_per_shard

This commit is contained in:
darshankabariya 2025-06-09 22:43:22 +05:30
parent 54387c0931
commit 8f4fb49b91
2 changed files with 11 additions and 1 deletions

View File

@ -17,8 +17,15 @@ func generateBucketsForHistogram*(length: int): seq[float64] =
return buckets
declarePublicCounter(
waku_rln_messages_total, "number of messages published on the rln content topic"
waku_rln_messages_total, "number of messages seen by the rln relay"
)
declarePublicGauge(
waku_rln_messages_per_shard,
"number of unique messages seen, grouped by shard",
labels = ["shard"],
)
declarePublicCounter(waku_rln_spam_messages_total, "number of spam messages detected")
declarePublicCounter(
waku_rln_invalid_messages_total, "number of invalid messages detected", ["type"]

View File

@ -213,6 +213,9 @@ proc validateMessage*(
# track message count for metrics
waku_rln_messages_total.inc()
let shard = msg.contentTopic
waku_rln_messages_per_shard.inc(labelValues = [$shard])
# checks if the message's timestamp is within acceptable range
let currentTime = getTime().toUnixFloat()
let messageTime = msg.timestamp.float64 / 1e9