mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
chore: add metrics and defined default value
This commit is contained in:
parent
7de94c5c2c
commit
45f7bac300
@ -62,6 +62,18 @@ declarePublicGauge(
|
||||
"time taken to import membership credentials",
|
||||
)
|
||||
|
||||
declarePublicCounter(
|
||||
waku_rln_proofs_generated_total,
|
||||
"number of RLN proofs generated by this light client for the current epoch",
|
||||
["type"]
|
||||
)
|
||||
|
||||
declarePublicGauge(
|
||||
waku_rln_proofs_remaining,
|
||||
"number of RLN proofs remaining in the budget for current epoch",
|
||||
["type"]
|
||||
)
|
||||
|
||||
type RLNMetricsLogger = proc() {.gcsafe, raises: [Defect].}
|
||||
|
||||
proc getRlnMetricsLogger*(): RLNMetricsLogger =
|
||||
@ -72,7 +84,8 @@ proc getRlnMetricsLogger*(): RLNMetricsLogger =
|
||||
var cumulativeSpamMessages = 0.float64
|
||||
var cumulativeInvalidMessages = 0.float64
|
||||
var cumulativeValidMessages = 0.float64
|
||||
var cumulativeProofs = 0.float64
|
||||
var cumulativeProofsVerified = 0.float64
|
||||
var cumulativeProofsGenerated = 0.float64
|
||||
|
||||
when defined(metrics):
|
||||
logMetrics = proc() =
|
||||
@ -87,13 +100,16 @@ proc getRlnMetricsLogger*(): RLNMetricsLogger =
|
||||
parseAndAccumulate(waku_rln_invalid_messages_total, cumulativeInvalidMessages)
|
||||
let freshValidMsgCount =
|
||||
parseAndAccumulate(waku_rln_valid_messages_total, cumulativeValidMessages)
|
||||
let freshProofCount =
|
||||
parseAndAccumulate(waku_rln_proof_verification_total, cumulativeProofs)
|
||||
let freshProofVerifiedCount =
|
||||
parseAndAccumulate(waku_rln_proof_verification_total, cumulativeProofsVerified)
|
||||
let freshProofsGeneratedCount =
|
||||
parseAndAccumulate(waku_rln_proofs_generated_total, cumulativeProofsGenerated)
|
||||
|
||||
info "Total messages", count = freshMsgCount
|
||||
info "Total spam messages", count = freshSpamCount
|
||||
info "Total invalid messages", count = freshInvalidMsgCount
|
||||
info "Total valid messages", count = freshValidMsgCount
|
||||
info "Total errors", count = freshErrorCount
|
||||
info "Total proofs verified", count = freshProofCount
|
||||
info "Total proofs verified", count = freshProofVerifiedCount
|
||||
info "Total proofs generated", count = freshProofsGeneratedCount
|
||||
return logMetrics
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user