Add peer address to N2_ConnectError trace events#12864
Open
hsson wants to merge 2 commits intoapple:mainfrom
Open
Add peer address to N2_ConnectError trace events#12864hsson wants to merge 2 commits intoapple:mainfrom
hsson wants to merge 2 commits intoapple:mainfrom
Conversation
68b86e8 to
5dac94c
Compare
The N2_ConnectError trace events were missing the peer IP address, making it difficult to identify which remote host failed to connect. This change adds PeerAddr and PeerAddress fields to all three N2_ConnectError logging locations in Net2.actor.cpp: - Connection::connect() for regular TCP connections - SSLConnection::connect() for TLS connections - SSLConnection::connectWithHostname() for TLS with SNI The BindPromise class already supported peer address logging, but setPeerAddr() was not being called for connection errors. This follows the same pattern used for other network error trace events (e.g., N2_ReadError, N2_WriteError, N2_AcceptHandshakeError) which already include peer address information.
5dac94c to
a9429da
Compare
gxglass
reviewed
Mar 26, 2026
Collaborator
gxglass
left a comment
There was a problem hiding this comment.
Thanks. The existing API seems obviously error-prone in retrospect. Do you think it would make sense to make the peer_address value be a parameter to the BindPromise constructor? Worst case, callers type NetworkAddress() and get a value with a bunch of zeros.
The previous API was error-prone as callers could forget to call setPeerAddr() after construction. By making peerAddr a required parameter, callers must consciously provide it (or NetworkAddress() if truly not applicable). Changes: - BindPromise constructors now require peerAddr parameter - Removed setPeerAddr() method - Updated all call sites to pass peer address at construction - Added comments for AcceptError cases where peer is unknown
Author
Thanks for the feedback, pushed another commit now that makes the peer address a mandatory parameter in the constructor! 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The N2_ConnectError trace events were missing the peer IP address, making it difficult to identify which remote host failed to connect. This change adds PeerAddr and PeerAddress fields to all three N2_ConnectError logging locations in Net2.actor.cpp:
The BindPromise class already supported peer address logging, but setPeerAddr() was not being called for connection errors. This follows the same pattern used for other network error trace events (e.g., N2_ReadError, N2_WriteError, N2_AcceptHandshakeError) which already include peer address information.
Code-Reviewer Section
The general pull request guidelines can be found here.
Please check each of the following things and check all boxes before accepting a PR.
For Release-Branches
If this PR is made against a release-branch, please also check the following:
release-branchormainif this is the youngest branch)