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

Make isRetryableBrokerErr public to identify retryable errors in hooks #877

Open
StarpTech opened this issue Dec 22, 2024 · 2 comments
Open
Labels
enhancement New feature or request waiting

Comments

@StarpTech
Copy link

StarpTech commented Dec 22, 2024

Hi, we're using the OnBrokerWrite hook to log errros

_ kgo.HookBrokerWrite = new(Metrics)
. Unfortunately, we see that even retryable errors are passed through the hook. This wouldn't be an issue, if we would have an easy way to identify those errors. The current isRetryableBrokerErr function isn't exposed. I propose to make it public or provide another way to identify retryable errors. Our goal is to use the hooks to log errors to alerts instability in our system. Thanks.

@twmb
Copy link
Owner

twmb commented Jan 8, 2025

What retryable errors are you seeing? The function you linked to has a lot of internalish logic that isn't general for user facing problems. The current user facing function to identify retryable errors is https://pkg.go.dev/github.com/twmb/franz-go/pkg/kerr#IsRetriable (back when I used the less common "retriable" unfortunately).

@twmb twmb added waiting enhancement New feature or request labels Jan 8, 2025
@StarpTech
Copy link
Author

StarpTech commented Jan 8, 2025

What retryable errors are you seeing?

Connection issue. We currently do

// EOF can be returned if a broker kills a connection unexpectedly. Same for ErrClosed.
// The client will reconnect to the broker, so we don't need to log this as an error.
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) {
	return
}

I actually don't know if this can be catched by the function you mentioned. Our general expectation is that we only get an error in hooks after max retry because retry is an internal detail. This would give us the information that something is not working reliably.

@twmb twmb mentioned this issue Jan 15, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting
Projects
None yet
Development

No branches or pull requests

2 participants