etcdserver: add "etcd_server_slow_read_indexes_total"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee
2018-07-02 12:53:01 -07:00
parent 4733a1db5c
commit 37000cc4b8
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,12 @@ var (
Name: "proposals_failed_total", Name: "proposals_failed_total",
Help: "The total number of failed proposals seen.", Help: "The total number of failed proposals seen.",
}) })
slowReadIndex = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "server",
Name: "slow_read_indexes_total",
Help: "The total number of pending read indexes not in sync with leader's or timed out read index requests.",
})
leaseExpired = prometheus.NewCounter(prometheus.CounterOpts{ leaseExpired = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "etcd_debugging", Namespace: "etcd_debugging",
Subsystem: "server", Subsystem: "server",
@ -109,6 +115,7 @@ func init() {
prometheus.MustRegister(proposalsApplied) prometheus.MustRegister(proposalsApplied)
prometheus.MustRegister(proposalsPending) prometheus.MustRegister(proposalsPending)
prometheus.MustRegister(proposalsFailed) prometheus.MustRegister(proposalsFailed)
prometheus.MustRegister(slowReadIndex)
prometheus.MustRegister(leaseExpired) prometheus.MustRegister(leaseExpired)
prometheus.MustRegister(quotaBackendBytes) prometheus.MustRegister(quotaBackendBytes)
prometheus.MustRegister(currentVersion) prometheus.MustRegister(currentVersion)

View File

@ -689,6 +689,7 @@ func (s *EtcdServer) linearizableReadLoop() {
} else { } else {
plog.Warningf("ignored out-of-date read index response; local node read indexes queueing up and waiting to be in sync with leader (request ID want %d, got %d)", id1, id2) plog.Warningf("ignored out-of-date read index response; local node read indexes queueing up and waiting to be in sync with leader (request ID want %d, got %d)", id1, id2)
} }
slowReadIndex.Inc()
} }
case <-time.After(s.Cfg.ReqTimeout()): case <-time.After(s.Cfg.ReqTimeout()):
if lg != nil { if lg != nil {
@ -698,6 +699,7 @@ func (s *EtcdServer) linearizableReadLoop() {
} }
nr.notify(ErrTimeout) nr.notify(ErrTimeout)
timeout = true timeout = true
slowReadIndex.Inc()
case <-s.stopping: case <-s.stopping:
return return
} }