mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 09:42:25 +00:00
improve autopilot logging when it starts up (#27464)
* improve autopilot logging when it starts up * add changelog
This commit is contained in:
3
changelog/27464.txt
Normal file
3
changelog/27464.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:improvement
|
||||
storage/raft: Improve autopilot logging on startup to show config values clearly and avoid spurious logs
|
||||
```
|
||||
@@ -89,6 +89,27 @@ type AutopilotConfig struct {
|
||||
UpgradeVersionTag string `mapstructure:"upgrade_version_tag"`
|
||||
}
|
||||
|
||||
func (ac *AutopilotConfig) String() string {
|
||||
s := "CleanupDeadServers:%t " +
|
||||
"LastContactThreshold:%s " +
|
||||
"DeadServerLastContactThreshold:%s " +
|
||||
"MaxTrailingLogs:%d " +
|
||||
"MinQuorum:%d " +
|
||||
"ServerStabilizationTime:%s " +
|
||||
"DisableUpgradeMigration:%t " +
|
||||
"RedundancyZoneTag:%s " +
|
||||
"UpgradeVersionTag:%s"
|
||||
return fmt.Sprintf(s, ac.CleanupDeadServers,
|
||||
ac.LastContactThreshold,
|
||||
ac.DeadServerLastContactThreshold,
|
||||
ac.MaxTrailingLogs,
|
||||
ac.MinQuorum,
|
||||
ac.ServerStabilizationTime,
|
||||
ac.DisableUpgradeMigration,
|
||||
ac.RedundancyZoneTag,
|
||||
ac.UpgradeVersionTag)
|
||||
}
|
||||
|
||||
// Merge combines the supplied config with the receiver. Supplied ones take
|
||||
// priority.
|
||||
func (to *AutopilotConfig) Merge(from *AutopilotConfig) {
|
||||
@@ -832,6 +853,8 @@ func (b *RaftBackend) SetupAutopilot(ctx context.Context, storageConfig *Autopil
|
||||
// Merge the setting provided over the API
|
||||
b.autopilotConfig.Merge(storageConfig)
|
||||
|
||||
infoArgs := []interface{}{"config", b.autopilotConfig}
|
||||
|
||||
// Create the autopilot instance
|
||||
options := []autopilot.Option{
|
||||
autopilot.WithLogger(b.logger),
|
||||
@@ -839,17 +862,18 @@ func (b *RaftBackend) SetupAutopilot(ctx context.Context, storageConfig *Autopil
|
||||
}
|
||||
if b.autopilotReconcileInterval != 0 {
|
||||
options = append(options, autopilot.WithReconcileInterval(b.autopilotReconcileInterval))
|
||||
infoArgs = append(infoArgs, []interface{}{"reconcile_interval", b.autopilotReconcileInterval}...)
|
||||
}
|
||||
if b.autopilotUpdateInterval != 0 {
|
||||
options = append(options, autopilot.WithUpdateInterval(b.autopilotUpdateInterval))
|
||||
infoArgs = append(infoArgs, []interface{}{"update_interval", b.autopilotUpdateInterval}...)
|
||||
}
|
||||
b.autopilot = autopilot.New(b.raft, NewDelegate(b), options...)
|
||||
b.followerStates = followerStates
|
||||
b.followerHeartbeatTicker = time.NewTicker(1 * time.Second)
|
||||
|
||||
b.l.Unlock()
|
||||
|
||||
b.logger.Info("starting autopilot", "config", b.autopilotConfig, "reconcile_interval", b.autopilotReconcileInterval)
|
||||
b.logger.Info("starting autopilot", infoArgs...)
|
||||
b.autopilot.Start(ctx)
|
||||
|
||||
go b.startFollowerHeartbeatTracker()
|
||||
|
||||
Reference in New Issue
Block a user