Skip to content

Commit 4128b33

Browse files
committed
etcdserver: add "etcd_server_snapshot_apply_inflights_total"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
1 parent a9309d0 commit 4128b33

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

etcdserver/metrics.go

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ var (
7676
Name: "slow_apply_total",
7777
Help: "The total number of slow apply requests (likely overloaded from slow disk).",
7878
})
79+
applySnapshotInProgress = prometheus.NewGauge(prometheus.GaugeOpts{
80+
Namespace: "etcd",
81+
Subsystem: "server",
82+
Name: "snapshot_apply_in_progress_total",
83+
Help: "1 if the server is applying the incoming snapshot. 0 if none.",
84+
})
7985
proposalsCommitted = prometheus.NewGauge(prometheus.GaugeOpts{
8086
Namespace: "etcd",
8187
Subsystem: "server",
@@ -153,6 +159,7 @@ func init() {
153159
prometheus.MustRegister(leaderChanges)
154160
prometheus.MustRegister(heartbeatSendFailures)
155161
prometheus.MustRegister(slowApplies)
162+
prometheus.MustRegister(applySnapshotInProgress)
156163
prometheus.MustRegister(proposalsCommitted)
157164
prometheus.MustRegister(proposalsApplied)
158165
prometheus.MustRegister(proposalsPending)

etcdserver/server.go

+2
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) {
11131113
if raft.IsEmptySnap(apply.snapshot) {
11141114
return
11151115
}
1116+
applySnapshotInProgress.Inc()
11161117

11171118
lg := s.getLogger()
11181119
if lg != nil {
@@ -1138,6 +1139,7 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) {
11381139
} else {
11391140
plog.Infof("finished applying incoming snapshot at index %d", ep.snapi)
11401141
}
1142+
applySnapshotInProgress.Dec()
11411143
}()
11421144

11431145
if apply.snapshot.Metadata.Index <= ep.appliedi {

0 commit comments

Comments
 (0)