chore(rln): remove old and add new rln metric (#1926)

This commit is contained in:
Alvaro Revuelta 2023-08-22 16:30:33 +02:00 committed by GitHub
parent 3d849541e2
commit 56c228f815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 16 deletions

View File

@ -79,6 +79,7 @@ method atomicBatch*(g: OnchainGroupManager,
let operationSuccess = g.rlnInstance.atomicWrite(some(start), idCommitments, toRemoveIndices) let operationSuccess = g.rlnInstance.atomicWrite(some(start), idCommitments, toRemoveIndices)
if not operationSuccess: if not operationSuccess:
raise newException(ValueError, "atomic batch operation failed") raise newException(ValueError, "atomic batch operation failed")
waku_rln_number_registered_memberships.inc(int64(idCommitments.len - toRemoveIndices.len))
if g.registerCb.isSome(): if g.registerCb.isSome():
var membersSeq = newSeq[Membership]() var membersSeq = newSeq[Membership]()
@ -421,8 +422,7 @@ method startGroupSync*(g: OnchainGroupManager): Future[void] {.async.} =
g.idCredentials = some(idCredential) g.idCredentials = some(idCredential)
debug "registering commitment on contract" debug "registering commitment on contract"
waku_rln_registration_duration_seconds.nanosecondTime: await g.register(idCredential)
await g.register(idCredential)
if g.registrationHandler.isSome(): if g.registrationHandler.isSome():
# We need to callback with the tx hash # We need to callback with the tx hash
let handler = g.registrationHandler.get() let handler = g.registrationHandler.get()

View File

@ -35,12 +35,11 @@ declarePublicHistogram(identifier = waku_rln_valid_messages_total,
buckets = generateBucketsForHistogram(AcceptableRootWindowSize)) buckets = generateBucketsForHistogram(AcceptableRootWindowSize))
declarePublicCounter(waku_rln_errors_total, "number of errors detected while operating the rln relay", ["type"]) declarePublicCounter(waku_rln_errors_total, "number of errors detected while operating the rln relay", ["type"])
declarePublicCounter(waku_rln_proof_verification_total, "number of times the rln proofs are verified") declarePublicCounter(waku_rln_proof_verification_total, "number of times the rln proofs are verified")
declarePublicCounter(waku_rln_number_registered_memberships, "number of registered and active rln memberships")
# Timing metrics # Timing metrics
declarePublicGauge(waku_rln_proof_verification_duration_seconds, "time taken to verify a proof") declarePublicGauge(waku_rln_proof_verification_duration_seconds, "time taken to verify a proof")
declarePublicGauge(waku_rln_relay_mounting_duration_seconds, "time taken to mount the waku rln relay")
declarePublicGauge(waku_rln_proof_generation_duration_seconds, "time taken to generate a proof") declarePublicGauge(waku_rln_proof_generation_duration_seconds, "time taken to generate a proof")
declarePublicGauge(waku_rln_registration_duration_seconds, "time taken to register to a rln membership set")
declarePublicGauge(waku_rln_instance_creation_duration_seconds, "time taken to create an rln instance") declarePublicGauge(waku_rln_instance_creation_duration_seconds, "time taken to create an rln instance")
declarePublicGauge(waku_rln_membership_insertion_duration_seconds, "time taken to insert a new member into the local merkle tree") declarePublicGauge(waku_rln_membership_insertion_duration_seconds, "time taken to insert a new member into the local merkle tree")
declarePublicGauge(waku_rln_membership_credentials_import_duration_seconds, "time taken to import membership credentials") declarePublicGauge(waku_rln_membership_credentials_import_duration_seconds, "time taken to import membership credentials")

View File

@ -399,9 +399,7 @@ proc new*(T: type WakuRlnRelay,
## Returns an error if the rln-relay protocol could not be mounted. ## Returns an error if the rln-relay protocol could not be mounted.
debug "rln-relay input validation passed" debug "rln-relay input validation passed"
try: try:
waku_rln_relay_mounting_duration_seconds.nanosecondTime: let rlnRelay = await mount(conf, registrationHandler)
let rlnRelay = await mount(conf,
registrationHandler)
return ok(rlnRelay) return ok(rlnRelay)
except CatchableError as e: except CatchableError as e:
return err(e.msg) return err(e.msg)