mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-06 15:22:08 -04:00
Log all recovered reconnects to backends
... to give the admin the all-clear. refs #351
This commit is contained in:
parent
f554fa9dfe
commit
b4bfee92d9
2 changed files with 12 additions and 0 deletions
|
|
@ -66,6 +66,12 @@ func dialWithLogging(logger *zap.SugaredLogger) func(context.Context, string, st
|
|||
logger.Warnw("Can't connect to Redis. Retrying", zap.Error(err))
|
||||
}
|
||||
},
|
||||
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
|
||||
if attempt > 0 {
|
||||
logger.Infow("Reconnected to Redis",
|
||||
zap.Duration("after", elapsed), zap.Uint64("attempts", attempt+1))
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,12 @@ func (c RetryConnector) Connect(ctx context.Context) (driver.Conn, error) {
|
|||
c.driver.Logger.Warnw("Can't connect to database. Retrying", zap.Error(err))
|
||||
}
|
||||
},
|
||||
OnSuccess: func(elapsed time.Duration, attempt uint64, _ error) {
|
||||
if attempt > 0 {
|
||||
c.driver.Logger.Infow("Reconnected to database",
|
||||
zap.Duration("after", elapsed), zap.Uint64("attempts", attempt+1))
|
||||
}
|
||||
},
|
||||
},
|
||||
), "can't connect to database")
|
||||
return conn, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue