feat(go): align TCP client logging with Rust SDK#3464
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (18.33%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #3464 +/- ##
============================================
+ Coverage 74.27% 74.70% +0.43%
Complexity 937 937
============================================
Files 1259 1248 -11
Lines 125969 122579 -3390
Branches 101644 99003 -2641
============================================
- Hits 93558 91576 -1982
+ Misses 29396 28036 -1360
+ Partials 3015 2967 -48
🚀 New features to boost your workflow:
|
chengxilo
left a comment
There was a problem hiding this comment.
nit: Just a minor stype recommendation
For example:
c.logger.Info("Retrying to connect to server...", "retry_count", n+1, "max_retries", attempts, "error", err)can be changed to
c.logger.Info("Retrying to connect to server...",
slog.Uint64("retry_count", uint64(n+1)),
slog.Uint64("max_retries", uint64(attempts)),
slog.Any("error", err))For detailed reason, check this reference:
https://www.dash0.com/guides/logging-in-go-with-slog#adding-contextual-attributes-to-your-logs
To be honest I think the previous approach may be more clear. But if we have a lot of KVs, we probably need this strong but ugly approach.
I don't know why Go doesn't provide function like slog.Uint() for convenience. 🤦♂️
Thanks. I went with slog attributes. Also, one thing I noticed is that Rust's SDK has a connection state guard in the |
Makes sense to me, just go ahead and add it : ) |
|
Done adding the state guard. |
atharvalade
left a comment
There was a problem hiding this comment.
lgtm only one nit: foreign/go/client/tcp/tcp_core.go line 409-410
Wouldn't it read better to log the error before invalidateConnLocked()? That way structured log output captures connection state at time-of-failure, not post-teardown. Minor thing though, both orderings work.
|
@atharvalade Thanks for the feedback! You're right, I've made the change. |
Which issue does this PR address?
Relates to #3460
Rationale
The Go SDK's TCP client has fewer diagnostic logs than the Rust SDK, making it harder to trace request/response flow, connection lifecycle events, authentication, TLS configuration issues, and leader redirection behavior.
What changed?
Added missing TCP client logs for requests, responses, connections, authentication, TLS errors, and leader redirection.
The logs were added to match the Rust SDK more closely and make debugging easier.
Local Execution
AI Usage