mirror of https://github.com/waku-org/nwaku.git
chore: set msg_hash logs to notice level (#2737)
This commit is contained in:
parent
e72bb7e7b5
commit
f5d87c5b23
|
@ -225,7 +225,7 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
|
||||||
return
|
return
|
||||||
|
|
||||||
proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
|
proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
|
||||||
debug "waku.relay received",
|
notice "waku.relay received",
|
||||||
my_peer_id = node.peerId,
|
my_peer_id = node.peerId,
|
||||||
pubsubTopic = topic,
|
pubsubTopic = topic,
|
||||||
msg_hash = topic.computeMessageHash(msg).to0xHex(),
|
msg_hash = topic.computeMessageHash(msg).to0xHex(),
|
||||||
|
@ -356,10 +356,10 @@ proc publish*(
|
||||||
#TODO instead of discard return error when 0 peers received the message
|
#TODO instead of discard return error when 0 peers received the message
|
||||||
discard await node.wakuRelay.publish(pubsubTopic, message)
|
discard await node.wakuRelay.publish(pubsubTopic, message)
|
||||||
|
|
||||||
trace "waku.relay published",
|
notice "waku.relay published",
|
||||||
peerId = node.peerId,
|
peerId = node.peerId,
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
hash = pubsubTopic.computeMessageHash(message).to0xHex(),
|
msg_hash = pubsubTopic.computeMessageHash(message).to0xHex(),
|
||||||
publishTime = getNowInNanosecondTime()
|
publishTime = getNowInNanosecondTime()
|
||||||
|
|
||||||
return ok()
|
return ok()
|
||||||
|
@ -952,7 +952,7 @@ proc mountLightPush*(
|
||||||
if publishedCount == 0:
|
if publishedCount == 0:
|
||||||
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
|
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
|
||||||
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
||||||
debug "Lightpush request has not been published to any peers",
|
notice "Lightpush request has not been published to any peers",
|
||||||
msg_hash = msgHash
|
msg_hash = msgHash
|
||||||
|
|
||||||
return ok()
|
return ok()
|
||||||
|
@ -994,7 +994,7 @@ proc lightpushPublish*(
|
||||||
): Future[WakuLightPushResult[void]] {.async, gcsafe.} =
|
): Future[WakuLightPushResult[void]] {.async, gcsafe.} =
|
||||||
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
|
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
|
||||||
if not node.wakuLightpushClient.isNil():
|
if not node.wakuLightpushClient.isNil():
|
||||||
debug "publishing message with lightpush",
|
notice "publishing message with lightpush",
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = message.contentTopic,
|
contentTopic = message.contentTopic,
|
||||||
target_peer_id = peer.peerId,
|
target_peer_id = peer.peerId,
|
||||||
|
@ -1002,7 +1002,7 @@ proc lightpushPublish*(
|
||||||
return await node.wakuLightpushClient.publish(pubsubTopic, message, peer)
|
return await node.wakuLightpushClient.publish(pubsubTopic, message, peer)
|
||||||
|
|
||||||
if not node.wakuLightPush.isNil():
|
if not node.wakuLightPush.isNil():
|
||||||
debug "publishing message with self hosted lightpush",
|
notice "publishing message with self hosted lightpush",
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = message.contentTopic,
|
contentTopic = message.contentTopic,
|
||||||
target_peer_id = peer.peerId,
|
target_peer_id = peer.peerId,
|
||||||
|
|
|
@ -103,7 +103,7 @@ proc handleMessage*(
|
||||||
else:
|
else:
|
||||||
getNanosecondTime(getTime().toUnixFloat())
|
getNanosecondTime(getTime().toUnixFloat())
|
||||||
|
|
||||||
trace "handling message",
|
notice "archive handling message",
|
||||||
msg_hash = msgHashHex,
|
msg_hash = msgHashHex,
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = msg.contentTopic,
|
contentTopic = msg.contentTopic,
|
||||||
|
@ -117,7 +117,7 @@ proc handleMessage*(
|
||||||
waku_archive_errors.inc(labelValues = [insertFailure])
|
waku_archive_errors.inc(labelValues = [insertFailure])
|
||||||
error "failed to insert message", error = error
|
error "failed to insert message", error = error
|
||||||
|
|
||||||
debug "message archived",
|
notice "message archived",
|
||||||
msg_hash = msgHashHex,
|
msg_hash = msgHashHex,
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = msg.contentTopic,
|
contentTopic = msg.contentTopic,
|
||||||
|
|
|
@ -152,7 +152,7 @@ proc handleSubscribeRequest*(
|
||||||
return FilterSubscribeResponse.ok(request.requestId)
|
return FilterSubscribeResponse.ok(request.requestId)
|
||||||
|
|
||||||
proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} =
|
proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} =
|
||||||
trace "pushing message to subscribed peer", peer = peer
|
trace "pushing message to subscribed peer", peer_id = shortLog(peer)
|
||||||
|
|
||||||
if not wf.peerManager.peerStore.hasPeer(peer, WakuFilterPushCodec):
|
if not wf.peerManager.peerStore.hasPeer(peer, WakuFilterPushCodec):
|
||||||
# Check that peer has not been removed from peer store
|
# Check that peer has not been removed from peer store
|
||||||
|
@ -176,7 +176,7 @@ proc pushToPeers(
|
||||||
let msgHash =
|
let msgHash =
|
||||||
messagePush.pubsubTopic.computeMessageHash(messagePush.wakuMessage).to0xHex()
|
messagePush.pubsubTopic.computeMessageHash(messagePush.wakuMessage).to0xHex()
|
||||||
|
|
||||||
debug "pushing message to subscribed peers",
|
notice "pushing message to subscribed peers",
|
||||||
pubsubTopic = messagePush.pubsubTopic,
|
pubsubTopic = messagePush.pubsubTopic,
|
||||||
contentTopic = messagePush.wakuMessage.contentTopic,
|
contentTopic = messagePush.wakuMessage.contentTopic,
|
||||||
target_peer_ids = targetPeerIds,
|
target_peer_ids = targetPeerIds,
|
||||||
|
@ -216,7 +216,7 @@ proc handleMessage*(
|
||||||
) {.async.} =
|
) {.async.} =
|
||||||
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
||||||
|
|
||||||
debug "handling message", pubsubTopic = pubsubTopic, msg_hash = msgHash
|
notice "handling message", pubsubTopic = pubsubTopic, msg_hash = msgHash
|
||||||
|
|
||||||
let handleMessageStartTime = Moment.now()
|
let handleMessageStartTime = Moment.now()
|
||||||
|
|
||||||
|
@ -225,8 +225,10 @@ proc handleMessage*(
|
||||||
let subscribedPeers =
|
let subscribedPeers =
|
||||||
wf.subscriptions.findSubscribedPeers(pubsubTopic, message.contentTopic)
|
wf.subscriptions.findSubscribedPeers(pubsubTopic, message.contentTopic)
|
||||||
if subscribedPeers.len == 0:
|
if subscribedPeers.len == 0:
|
||||||
debug "no subscribed peers found",
|
notice "no subscribed peers found",
|
||||||
pubsubTopic = pubsubTopic, contentTopic = message.contentTopic
|
pubsubTopic = pubsubTopic,
|
||||||
|
contentTopic = message.contentTopic,
|
||||||
|
msg_hash = msgHash
|
||||||
return
|
return
|
||||||
|
|
||||||
let messagePush = MessagePush(pubsubTopic: pubsubTopic, wakuMessage: message)
|
let messagePush = MessagePush(pubsubTopic: pubsubTopic, wakuMessage: message)
|
||||||
|
@ -242,7 +244,7 @@ proc handleMessage*(
|
||||||
target_peer_ids = subscribedPeers.mapIt(shortLog(it))
|
target_peer_ids = subscribedPeers.mapIt(shortLog(it))
|
||||||
waku_filter_errors.inc(labelValues = [pushTimeoutFailure])
|
waku_filter_errors.inc(labelValues = [pushTimeoutFailure])
|
||||||
else:
|
else:
|
||||||
debug "pushed message succesfully to all subscribers",
|
notice "pushed message succesfully to all subscribers",
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = message.contentTopic,
|
contentTopic = message.contentTopic,
|
||||||
msg_hash = msgHash,
|
msg_hash = msgHash,
|
||||||
|
|
|
@ -50,11 +50,11 @@ proc handleRequest*(
|
||||||
pubSubTopic = request.get().pubSubTopic
|
pubSubTopic = request.get().pubSubTopic
|
||||||
message = request.get().message
|
message = request.get().message
|
||||||
waku_lightpush_messages.inc(labelValues = ["PushRequest"])
|
waku_lightpush_messages.inc(labelValues = ["PushRequest"])
|
||||||
debug "push request",
|
notice "lightpush request",
|
||||||
peerId = peerId,
|
peer_id = peerId,
|
||||||
requestId = requestId,
|
requestId = requestId,
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
hash = pubsubTopic.computeMessageHash(message).to0xHex()
|
msg_hash = pubsubTopic.computeMessageHash(message).to0xHex()
|
||||||
|
|
||||||
let handleRes = await wl.pushHandler(peerId, pubsubTopic, message)
|
let handleRes = await wl.pushHandler(peerId, pubsubTopic, message)
|
||||||
isSuccess = handleRes.isOk()
|
isSuccess = handleRes.isOk()
|
||||||
|
|
|
@ -206,15 +206,17 @@ proc generateOrderedValidator(w: WakuRelay): auto {.gcsafe.} =
|
||||||
pubsubTopic = pubsubTopic, error = $error
|
pubsubTopic = pubsubTopic, error = $error
|
||||||
return ValidationResult.Reject
|
return ValidationResult.Reject
|
||||||
|
|
||||||
let msgHash = computeMessageHash(pubsubTopic, msg).to0xHex()
|
|
||||||
|
|
||||||
# now sequentially validate the message
|
# now sequentially validate the message
|
||||||
for (validator, _) in w.wakuValidators:
|
for (validator, errorMessage) in w.wakuValidators:
|
||||||
let validatorRes = await validator(pubsubTopic, msg)
|
let validatorRes = await validator(pubsubTopic, msg)
|
||||||
|
|
||||||
if validatorRes != ValidationResult.Accept:
|
if validatorRes != ValidationResult.Accept:
|
||||||
|
let msgHash = computeMessageHash(pubsubTopic, msg).to0xHex()
|
||||||
error "protocol generateOrderedValidator reject waku validator",
|
error "protocol generateOrderedValidator reject waku validator",
|
||||||
msg_hash = msgHash, pubsubTopic = pubsubTopic, validatorRes = validatorRes
|
msg_hash = msgHash,
|
||||||
|
pubsubTopic = pubsubTopic,
|
||||||
|
validatorRes = validatorRes,
|
||||||
|
error = errorMessage
|
||||||
|
|
||||||
return validatorRes
|
return validatorRes
|
||||||
|
|
||||||
|
@ -305,8 +307,8 @@ proc publish*(
|
||||||
w: WakuRelay, pubsubTopic: PubsubTopic, message: WakuMessage
|
w: WakuRelay, pubsubTopic: PubsubTopic, message: WakuMessage
|
||||||
): Future[int] {.async.} =
|
): Future[int] {.async.} =
|
||||||
let data = message.encode().buffer
|
let data = message.encode().buffer
|
||||||
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
|
||||||
|
|
||||||
debug "start publish Waku message", msg_hash = msgHash, pubsubTopic = pubsubTopic
|
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
||||||
|
notice "start publish Waku message", msg_hash = msgHash, pubsubTopic = pubsubTopic
|
||||||
|
|
||||||
return await procCall GossipSub(w).publish(pubsubTopic, data)
|
return await procCall GossipSub(w).publish(pubsubTopic, data)
|
||||||
|
|
Loading…
Reference in New Issue