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: log node peer ID with relay trace logging #1574

Merged
merged 2 commits into from
Feb 27, 2023
Merged

Conversation

jm-clius
Copy link
Contributor

Logs the peer ID when trace logging relay messages.

Requested by Wakurtosis as a requirement/improvement when scraping logs.

@jm-clius jm-clius marked this pull request as ready for review February 24, 2023 08:00
@jm-clius jm-clius requested a review from LNSD February 24, 2023 08:00
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my comment 🙂

@@ -401,6 +401,7 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =

proc traceHandler(topic: PubsubTopic, data: seq[byte]) {.async, gcsafe.} =
trace "waku.relay received",
peerId=node.switch.peerInfo.peerId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this leaks the "switch" implementation detail. Could you add a proc peerId(): PeerId = to WakuNode?

IIRC, I already added a peerInfo proc. It would be as simple as adding a PeerId accessor, so we don't leak the "switch" in different places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah makes sense.

Done in 6429b90

@jm-clius jm-clius requested a review from LNSD February 27, 2023 14:22
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@jm-clius jm-clius merged commit c254115 into master Feb 27, 2023
@jm-clius jm-clius deleted the chore/log-peer-id branch February 27, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants