Repository navigation
Log remote/local endpoint details - #742
Merged
Merged
Conversation
rhysparry
marked this pull request as ready for review
November 20, 2026 01:20
LukeButters
reviewed
Nov 20, 2026
| { | ||
| return client?.Client.LocalEndPoint?.ToString() ?? "<none>"; | ||
| } | ||
| catch |
Contributor
There was a problem hiding this comment.
I wonder why this would ever throw?
Contributor
Author
There was a problem hiding this comment.
I don't think it can. It's following the pattern from GetRemoteEndpointString() below.
LukeButters
approved these changes
Nov 20, 2026
This was referenced Nov 22, 2026
Closed
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.
Background
When diagnosing connectivity problems from Tentacle logs, we can see which remote address a connection went to (or came from), but never which local address and port were used. On hosts with multiple interfaces, or behind NAT, knowing the local side of the socket makes it much easier to match a connection up with firewall, load balancer or packet capture logs.
Halibut already logs the remote endpoint in a few places:
Connection established to {remote} for {uri}(Trace) andSecure connection established. Server at {remote} identified by thumbprint: ...(Info)Accepted TCP client: {remote}/Accepted Web Socket client: {remote}(Info)None of these include the local endpoint. For listening connections, the log context is the listener's bound address (for example
listen://0.0.0.0:10933), which doesn't tell you which interface actually accepted the connection.Results
Adds the local endpoint to the existing connection log messages:
TcpClientExtensions: newGetLocalEndpointString(), mirroring the existingGetRemoteEndpointString()(returns<none>/<error>rather than throwing).TcpConnectionFactory:Connection established to {remote} from {local} for {uri}Secure connection established. Server at {remote} identified by thumbprint: {thumbprint}, using protocol {protocol}, from local endpoint {local}client.Client.RemoteEndPointdirectly.SecureListener:Accepted TCP client: {remote} on local endpoint {local}SecureWebSocketListener:Accepted Web Socket client: {remote} on local endpoint {local}No log levels change, so the Info-level messages above will appear in Tentacle's log file at its default log level.
Notes:
ClientWebSocketdoesn't expose the local endpoint.Part of LEV-983 (Tentacle will pick this up via a Halibut version bump, alongside adding the timezone offset to Tentacle's log timestamps).
Before
After
(Illustrative addresses, showing the message shapes.)
How to review this PR
Quality ✔️
Small, log-message-only change. Nothing in Halibut or Tentacle matches on these message strings.
Pre-requisites
🤖 Generated with Claude Code
🤖 Agent's description, endorsed by Rhys