mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-09 01:13:08 +00:00
archive: continue giving some more clarity in error logs
This commit is contained in:
parent
2ffca2078b
commit
25d3847413
@ -85,34 +85,41 @@ proc new*(
|
||||
proc handleMessage*(
|
||||
self: WakuArchive, pubsubTopic: PubsubTopic, msg: WakuMessage
|
||||
) {.async.} =
|
||||
let
|
||||
msgHash = computeMessageHash(pubsubTopic, msg)
|
||||
msgHashHex = msgHash.to0xHex()
|
||||
|
||||
self.validator(msg).isOkOr:
|
||||
waku_archive_errors.inc(labelValues = [error])
|
||||
trace "invalid message",
|
||||
msg_hash = computeMessageHash(pubsubTopic, msg).to0xHex(),
|
||||
error "failed validator message",
|
||||
msg_hash = msgHashHex,
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
timestamp = msg.timestamp,
|
||||
error = error
|
||||
msgTimestamp = msg.timestamp,
|
||||
usedTimestamp = msgTimestamp,
|
||||
digest = msgDigestHex,
|
||||
error = $error
|
||||
waku_archive_errors.inc(labelValues = [error])
|
||||
return
|
||||
|
||||
let msgHash = computeMessageHash(pubsubTopic, msg)
|
||||
let insertStartTime = getTime().toUnixFloat()
|
||||
|
||||
(await self.driver.put(msgHash, pubsubTopic, msg)).isOkOr:
|
||||
waku_archive_errors.inc(labelValues = [insertFailure])
|
||||
trace "failed to insert message",
|
||||
error "failed to insert message",
|
||||
msg_hash = msgHash.to0xHex(),
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
timestamp = msg.timestamp,
|
||||
error = error
|
||||
error = $error
|
||||
return
|
||||
|
||||
trace "message archived",
|
||||
msg_hash = msgHash.to0xHex(),
|
||||
debug "message archived",
|
||||
msg_hash = msgHashHex,
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
timestamp = msg.timestamp
|
||||
msgTimestamp = msg.timestamp,
|
||||
usedTimestamp = msgTimestamp,
|
||||
digest = msgDigestHex
|
||||
|
||||
let insertDuration = getTime().toUnixFloat() - insertStartTime
|
||||
waku_archive_insert_duration_seconds.observe(insertDuration)
|
||||
@ -127,7 +134,7 @@ proc syncMessageIngress*(
|
||||
|
||||
(await self.driver.put(msgHash, pubsubTopic, msg)).isOkOr:
|
||||
waku_archive_errors.inc(labelValues = [insertFailure])
|
||||
trace "failed to insert message",
|
||||
error "failed to insert message",
|
||||
msg_hash = msgHash.to0xHex(),
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
|
||||
@ -79,15 +79,25 @@ proc new*(
|
||||
proc handleMessage*(
|
||||
self: WakuArchive, pubsubTopic: PubsubTopic, msg: WakuMessage
|
||||
) {.async.} =
|
||||
let
|
||||
msgHash = computeMessageHash(pubsubTopic, msg)
|
||||
msgHashHex = msgHash.to0xHex()
|
||||
|
||||
self.validator(msg).isOkOr:
|
||||
error "failed validator message",
|
||||
msg_hash = msgHashHex,
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
msgTimestamp = msg.timestamp,
|
||||
usedTimestamp = msgTimestamp,
|
||||
digest = msgDigestHex,
|
||||
error = $error
|
||||
waku_legacy_archive_errors.inc(labelValues = [error])
|
||||
return
|
||||
|
||||
let
|
||||
msgDigest = computeDigest(msg)
|
||||
msgDigestHex = msgDigest.data.to0xHex()
|
||||
msgHash = computeMessageHash(pubsubTopic, msg)
|
||||
msgHashHex = msgHash.to0xHex()
|
||||
msgTimestamp =
|
||||
if msg.timestamp > 0:
|
||||
msg.timestamp
|
||||
@ -106,7 +116,13 @@ proc handleMessage*(
|
||||
|
||||
(await self.driver.put(pubsubTopic, msg, msgDigest, msgHash, msgTimestamp)).isOkOr:
|
||||
waku_legacy_archive_errors.inc(labelValues = [insertFailure])
|
||||
error "failed to insert message", error = error
|
||||
error "failed to insert message",
|
||||
msg_hash = msgHashHex,
|
||||
pubsubTopic = pubsubTopic,
|
||||
contentTopic = msg.contentTopic,
|
||||
msgTimestamp = msg.timestamp,
|
||||
digest = msgDigestHex,
|
||||
error = $error
|
||||
return
|
||||
|
||||
debug "message archived",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user