Skip to content

Commit

Permalink
[raft] add some metrics to monitor zombies (#8184)
Browse files Browse the repository at this point in the history
  • Loading branch information
luluz66 authored Jan 15, 2025
1 parent a6ba7df commit 4987ddd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions enterprise/server/raft/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1534,8 +1534,10 @@ func (j *replicaJanitor) Start(ctx context.Context) {
case task := <-j.tasks:
action, err := j.removeZombie(ctx, task)
if err != nil {
j.store.log.Errorf("failed to remove zombie c%dn%d: %s", task.rangeID, task.replicaID, err)
task.action = action
j.tasks <- task
metrics.RaftZombieCleanupErrorCount.Inc()
} else {
j.mu.Lock()
delete(j.rangeIDsInQueue, task.rangeID)
Expand Down Expand Up @@ -1616,6 +1618,7 @@ func (j *replicaJanitor) scan(ctx context.Context) {
}
}
}
metrics.RaftZombieCleanupTasks.Set(float64(len(j.tasks)))
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions server/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,20 @@ var (
StatusHumanReadableLabel,
})

RaftZombieCleanupTasks = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: bbNamespace,
Subsystem: "raft",
Name: "zombie_cleanup_tasks",
Help: "The total number of pending zombie cleanup tasks",
})

RaftZombieCleanupErrorCount = promauto.NewCounter(prometheus.CounterOpts{
Namespace: bbNamespace,
Subsystem: "raft",
Name: "zombie_cleanup_errors",
Help: "The total number of zombie cleanup errors",
})

APIKeyLookupCount = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: bbNamespace,
Subsystem: "auth",
Expand Down

0 comments on commit 4987ddd

Please sign in to comment.