Skip to content

Commit

Permalink
Set replication metric to 0 when losing leadership
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemarey committed Apr 26, 2024
1 parent 2baf5e7 commit 9e3747e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions agent/consul/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,19 @@ func (s *Server) runACLReplicator(

index, exit, err := replicateFunc(ctx, logger, lastRemoteIndex)
if exit {
metrics.SetGauge([]string{"leader", "replication", metricName, "status"},
0,
)
return nil
}

if err != nil {
metrics.SetGauge([]string{"leader", "replication", metricName, "status"},
0,
)
metrics.SetGauge([]string{"leader", "replication", metricName, "index"},
0,
)
lastRemoteIndex = 0
s.updateACLReplicationStatusError(err.Error())
logger.Warn("ACL replication error (will retry if still leader)",
Expand Down

0 comments on commit 9e3747e

Please sign in to comment.