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

Improve logging and error handling, #5

Merged
merged 5 commits into from
Feb 5, 2024
Merged

Improve logging and error handling, #5

merged 5 commits into from
Feb 5, 2024

Conversation

PapaCharlie
Copy link
Member

@PapaCharlie PapaCharlie commented Jan 31, 2024

Overhauls the logging and error responses from the *Conn. Namely, it changes the logging backend to log/slog which makes it easier to manage the library's logging centrally. It also captures the reason why a specific connection to a ZK server was closed in the error that is propagated to all callers. This can be checked with errors.Is.

This overhauls the logging and error responses from the *Conn. Namely, it
changes the logging backend to `log/slog` which makes it easier to manage the
library's logging centrally (however the old functionally to provide a custom
logger is retained). It also captures the reason why a specific connection to a
ZK server was closed in the error that is propagated to all callers. This can be
checked with `errors.Is`.

This also adds an exponential backoff feature to the client, which will make it
back off when reconnecting to a ZK server.
Copy link

@shivamgupta1 shivamgupta1 left a comment

Choose a reason for hiding this comment

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

Not sure about this one. It's a big change and it's already getting further and further away from the upstream (9 commits behind). It'll be a big pain to merge the upstream changes and we might miss out on important bug fixes and improvements.

@PapaCharlie
Copy link
Member Author

PapaCharlie commented Feb 1, 2024 via email

@PapaCharlie
Copy link
Member Author

PapaCharlie commented Feb 1, 2024 via email

conn.go Outdated Show resolved Hide resolved
@shivamgupta1
Copy link

shivamgupta1 commented Feb 1, 2024

@PapaCharlie https://github.com/samuel/go-zookeeper is the one that seems unmaintained (last commits were 4 years ago). https://github.com/go-zookeeper/zk seems to have had recent commits (3 months ago). Do you mind double checking this, and confirming that indeed there are no owners? Also, how's the process for becoming official maintainers going to be like?

Nevertheless, it might need to be discussed with the management (if not already done) in case we are trying to take up ownership of a large project that most people in the team don't know much about.

@PapaCharlie
Copy link
Member Author

These are the 8 commits that we're behind on:
image
They're all updating the github actions etc, no actual changes. I will merge with the upstream if you want, just to be safe

@PapaCharlie PapaCharlie changed the title Improve logging and error handling Improve logging and error handling, fix DNSHostProvider Feb 2, 2024
@PapaCharlie PapaCharlie changed the title Improve logging and error handling, fix DNSHostProvider Fix DNSHostProvider, improve logging and error handling, Feb 2, 2024
dnshostprovider.go Outdated Show resolved Hide resolved
dnshostprovider.go Outdated Show resolved Hide resolved
dnshostprovider_test.go Outdated Show resolved Hide resolved
dnshostprovider_test.go Outdated Show resolved Hide resolved
@PapaCharlie PapaCharlie changed the base branch from master to pc/hp February 2, 2024 21:45
@PapaCharlie PapaCharlie changed the title Fix DNSHostProvider, improve logging and error handling, Improve logging and error handling, Feb 2, 2024
@bohhyang bohhyang mentioned this pull request Feb 2, 2024
@PapaCharlie PapaCharlie merged commit e589e29 into pc/hp Feb 5, 2024
PapaCharlie added a commit that referenced this pull request Feb 5, 2024
* Improve logging and error handling

This overhauls the logging and error responses from the *Conn. Namely, it
changes the logging backend to `log/slog` which makes it easier to manage the
library's logging centrally (however the old functionally to provide a custom
logger is retained). It also captures the reason why a specific connection to a
ZK server was closed in the error that is propagated to all callers. This can be
checked with `errors.Is`.

This also adds an exponential backoff feature to the client, which will make it
back off when reconnecting to a ZK server.

* Remove logger option, it messes with the logging

* Change default behavior of DNSHostProvider

* Split implementation of HostProvider, fix up tests
PapaCharlie added a commit that referenced this pull request Feb 5, 2024
* Improve logging and error handling

This overhauls the logging and error responses from the *Conn. Namely, it
changes the logging backend to `log/slog` which makes it easier to manage the
library's logging centrally (however the old functionally to provide a custom
logger is retained). It also captures the reason why a specific connection to a
ZK server was closed in the error that is propagated to all callers. This can be
checked with `errors.Is`.

This also adds an exponential backoff feature to the client, which will make it
back off when reconnecting to a ZK server.

* Remove logger option, it messes with the logging

* Change default behavior of DNSHostProvider

* Split implementation of HostProvider, fix up tests
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.

3 participants