mirror of https://github.com/status-im/consul.git
Set replication metric to 0 when losing leadership (#20665)
* Set replication metric to 0 when losing leadership * Fix replication metrics on replication.go also --------- Co-authored-by: sarahalsmiller <100602640+sarahalsmiller@users.noreply.github.com>
This commit is contained in:
parent
ab794b59f8
commit
d12f9cf4d1
|
@ -771,6 +771,12 @@ func (s *Server) runACLReplicator(
|
||||||
|
|
||||||
index, exit, err := replicateFunc(ctx, logger, lastRemoteIndex)
|
index, exit, err := replicateFunc(ctx, logger, lastRemoteIndex)
|
||||||
if exit {
|
if exit {
|
||||||
|
metrics.SetGauge([]string{"leader", "replication", metricName, "status"},
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
metrics.SetGauge([]string{"leader", "replication", metricName, "index"},
|
||||||
|
0,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,12 @@ func (r *Replicator) Run(ctx context.Context) error {
|
||||||
// Perform a single round of replication
|
// Perform a single round of replication
|
||||||
index, exit, err := r.delegate.Replicate(ctx, atomic.LoadUint64(&r.lastRemoteIndex), r.logger)
|
index, exit, err := r.delegate.Replicate(ctx, atomic.LoadUint64(&r.lastRemoteIndex), r.logger)
|
||||||
if exit {
|
if exit {
|
||||||
|
metrics.SetGauge([]string{"leader", "replication", r.delegate.MetricName(), "status"},
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
metrics.SetGauge([]string{"leader", "replication", r.delegate.MetricName(), "index"},
|
||||||
|
0,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue