Skip to content

Log all different failed and recovered reconnects to backends - #369

Merged
julianbrost merged 5 commits into
masterfrom
feature/log-reconnects-351
Sep 24, 2021
Merged

julianbrost merged 5 commits into
masterfrom
feature/log-reconnects-351

Conversation

@Al2Klimov

@Al2Klimov Al2Klimov commented Sep 22, 2021 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Comment thread pkg/config/redis.go Outdated
},
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
if attempt > 0 {
logger.Infow("Re-connected to Redis",

Copy link
Copy Markdown
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.

Comment thread pkg/driver/driver.go Outdated
},
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
if attempt > 0 {
c.driver.Logger.Infow("Re-connected to database",

Copy link
Copy Markdown
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.

Comment thread pkg/retry/retry.go
// Once the specified timeout (if >0) elapses, WithBackoff gives up.
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
Copy Markdown
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
Copy Markdown
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