Skip to content

Commit

Permalink
add temporary logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed Oct 16, 2024
1 parent 16aa4e1 commit a00afcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -244,33 +244,42 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
return

proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
info "AAAAA traceHandler"
let msg_hash = topic.computeMessageHash(msg).to0xHex()
info "AAAAA traceHandler"
let msgSizeKB = msg.payload.len / 1000

waku_node_messages.inc(labelValues = ["relay"])
info "AAAAA traceHandler"
waku_histogram_message_size.observe(msgSizeKB)

proc filterHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
if node.wakuFilter.isNil():
return

info "AAAA filterHandler "
await node.wakuFilter.handleMessage(topic, msg)

proc archiveHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
info "AAAA archiveHandler"
if not node.wakuLegacyArchive.isNil():
info "AAAA archiveHandler"
## we try to store with legacy archive
await node.wakuLegacyArchive.handleMessage(topic, msg)
return

if node.wakuArchive.isNil():
info "AAAA archiveHandler"
return

await node.wakuArchive.handleMessage(topic, msg)

proc syncHandler(topic: PubsubTopic, msg: WakuMessage) {.async.} =
info "AAAAA syncHandler"
if node.wakuSync.isNil():
info "AAAAA syncHandler"
return

info "AAAAA syncHandler"
node.wakuSync.messageIngress(topic, msg)

let defaultHandler = proc(
Expand Down
6 changes: 5 additions & 1 deletion waku/waku_archive/archive.nim
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ proc new*(
proc handleMessage*(
self: WakuArchive, pubsubTopic: PubsubTopic, msg: WakuMessage
) {.async.} =
info "AAAA handleMessage"
self.validator(msg).isOkOr:
info "AAAA handleMessage ", error = $error
waku_archive_errors.inc(labelValues = [error])
return

let msgHash = computeMessageHash(pubsubTopic, msg)
let insertStartTime = getTime().toUnixFloat()

info "AAAA handleMessage "
(await self.driver.put(msgHash, pubsubTopic, msg)).isOkOr:
waku_archive_errors.inc(labelValues = [insertFailure])
info "AAAA handleMessage "
trace "failed to insert message",
hash_hash = msgHash.to0xHex(),
pubsubTopic = pubsubTopic,
Expand All @@ -101,7 +105,7 @@ proc handleMessage*(
error = error
return

trace "message archived",
info "message archived",
hash_hash = msgHash.to0xHex(),
pubsubTopic = pubsubTopic,
contentTopic = msg.contentTopic,
Expand Down

0 comments on commit a00afcb

Please sign in to comment.