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

Log all different failed and recovered reconnects to backends #369

Merged
merged 5 commits into from
Sep 24, 2021

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Sep 22, 2021

E.g. the first "connection refused", the first "hostname mismatch" and the all-clear.

fixes #351

@Al2Klimov Al2Klimov requested a review from lippserd September 22, 2021 14:35
@cla-bot cla-bot bot added the cla/signed label Sep 22, 2021
@Al2Klimov
Copy link
Member Author

2021-09-22T16:28:03.134+0200    WARN    config/redis.go:66      Can't connect to Redis. Retrying        {"error": "dial tcp 127.0.0.1:6380: connect: connection refused"}
2021-09-22T16:28:19.135+0200    INFO    config/redis.go:71      Re-connected to Redis   {"after": "16.001105518s", "attempts": 30}

@Al2Klimov
Copy link
Member Author

2021-09-22T16:32:54.077+0200    INFO    icingadb/main.go:45     Connecting to database
2021-09-22T16:32:54.077+0200    WARN    driver/driver.go:39     Can't connect to database. Retrying     {"error": "dial tcp 127.0.0.1:6033: connect: connection refused"}
2021-09-22T16:33:05.357+0200    DEBUG   driver/driver.go:80     [unexpected EOF]
2021-09-22T16:33:05.357+0200    WARN    driver/driver.go:39     Can't connect to database. Retrying     {"error": "driver: bad connection"}
2021-09-22T16:33:16.202+0200    INFO    driver/driver.go:44     Re-connected to database        {"after": "22.125350414s", "attempts": 9}

@lippserd lippserd added this to the v1.0.0-rc2 milestone Sep 23, 2021
},
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
if attempt > 0 {
logger.Infow("Re-connected to Redis",
Copy link
Member

Choose a reason for hiding this comment

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

I think we can write Reconnected instead of Re-connected.

},
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
if attempt > 0 {
c.driver.Logger.Infow("Re-connected to database",
Copy link
Member

Choose a reason for hiding this comment

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

I think we can write Reconnected instead of Re-connected.

func WithBackoff(
ctx context.Context, retryableFunc RetryableFunc, retryable IsRetryable, b backoff.Backoff, timeout time.Duration,
ctx context.Context, retryableFunc RetryableFunc, retryable IsRetryable, b backoff.Backoff, settings Settings,
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to not use a pointer for settings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Go would allocate the &Settings{} on the stack, too.

... to give the admin the all-clear.

refs #351
@Al2Klimov Al2Klimov force-pushed the feature/log-reconnects-351 branch from 2533ded to b4bfee9 Compare September 23, 2021 14:07
@Al2Klimov Al2Klimov requested a review from lippserd September 23, 2021 14:07
@julianbrost julianbrost merged commit 0c9fb2f into master Sep 24, 2021
@julianbrost julianbrost deleted the feature/log-reconnects-351 branch September 24, 2021 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log reconnects
3 participants