Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: lightpush - error metric less variable by only setting a fixed string #3020

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions tests/node/test_wakunode_lightpush.nim
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ suite "Waku Lightpush - End To End":

# Then the message is not relayed but not due to RLN
assert publishResponse.isErr(), "We expect an error response"
assert (
publishResponse.error.contains(
"Lightpush request has not been published to any peers"
)
), "incorrect error response"

assert (publishResponse.error == protocol_metrics.notPublishedAnyPeer),
"incorrect error response"

suite "Waku LightPush Validation Tests":
asyncTest "Validate message size exceeds limit":
Expand Down
5 changes: 2 additions & 3 deletions waku/waku_lightpush/callbacks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import
../waku_relay,
./common,
./protocol,
./protocol_metrics,
../waku_rln_relay,
../waku_rln_relay/protocol_types

Expand Down Expand Up @@ -54,8 +55,6 @@ proc getRelayPushHandler*(
## 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()
notice "Lightpush request has not been published to any peers", msg_hash = msgHash
return err(
"Lightpush request has not been published to any peers. msg_hash: " & msgHash
)
return err(protocol_metrics.notPublishedAnyPeer)

return ok()
1 change: 1 addition & 0 deletions waku/waku_lightpush/protocol_metrics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ const
emptyResponseBodyFailure* = "empty_response_body_failure"
messagePushFailure* = "message_push_failure"
requestLimitReachedFailure* = "request_limit_reached_failure"
notPublishedAnyPeer* = "not_published_to_any_peer"
Loading