Skip to content

Adding more logs to ws client for connect - #193

Merged
EnriqueL8 merged 3 commits into
hyperledger-firefly:mainfrom
kaleido-io:adding-logs-to-ws-client
Oct 16, 2025
Merged

Adding more logs to ws client for connect#193
EnriqueL8 merged 3 commits into
hyperledger-firefly:mainfrom
kaleido-io:adding-logs-to-ws-client

Conversation

@Chengxuan

Copy link
Copy Markdown
Contributor

Add more logs to connect and reconnect logic for debugging purposes. The code paths do not execute once the websocket client is in normal operation mode(heavy traffic). Therefore, I think it's helpful to make them verbose.

Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
@Chengxuan
Chengxuan requested a review from a team October 9, 2025 10:49

@EnriqueL8 EnriqueL8 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Chengxuan this is going to be super helpful to diagnose

Comment thread pkg/wsclient/wsclient.go Outdated
Comment thread pkg/wsclient/wsclient.go Outdated
Comment thread pkg/wsclient/wsclient.go Outdated
Comment thread pkg/wsclient/wsclient.go
func (w *wsClient) connect(initial bool) error {
l := log.L(w.ctx)
l.Debugf("WS %s connecting, isInitial: %t", w.url, initial)
return w.connRetry.DoCustomLog(w.ctx, func(attempt int) (retry bool, err error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

aah DoCustomLog doesn't log attempts, now it makes sense to add the below attempt logs!

Comment thread pkg/wsclient/wsclient.go Outdated
Comment thread pkg/wsclient/wsclient.go Outdated
Comment thread pkg/wsclient/wsclient.go Outdated
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
@Chengxuan

Chengxuan commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the review. @EnriqueL8 I've addressed the review comments.

I've kept the '%v' , err) syntax regardless of whether it's inside an if err!=nil condition

@Chengxuan
Chengxuan requested a review from EnriqueL8 October 16, 2025 14:15

@EnriqueL8 EnriqueL8 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Chengxuan - looks good now

@EnriqueL8
EnriqueL8 merged commit 553d4a9 into hyperledger-firefly:main Oct 16, 2025
5 checks passed
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