diff --git a/etcdserver/metrics.go b/etcdserver/metrics.go index 60e5395a3008..670e62a62dc0 100644 --- a/etcdserver/metrics.go +++ b/etcdserver/metrics.go @@ -78,6 +78,12 @@ var ( Name: "proposals_failed_total", Help: "The total number of failed proposals seen.", }) + readIndexPending = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "etcd", + Subsystem: "server", + Name: "read_indexes_pending_total", + Help: "The total number of pending read indexes not in sync with leader's.", + }) leaseExpired = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: "etcd_debugging", Subsystem: "server", @@ -109,6 +115,7 @@ func init() { prometheus.MustRegister(proposalsApplied) prometheus.MustRegister(proposalsPending) prometheus.MustRegister(proposalsFailed) + prometheus.MustRegister(readIndexPending) prometheus.MustRegister(leaseExpired) prometheus.MustRegister(quotaBackendBytes) prometheus.MustRegister(currentVersion) diff --git a/etcdserver/v3_server.go b/etcdserver/v3_server.go index 5826af2fe07f..6598367fdd9c 100644 --- a/etcdserver/v3_server.go +++ b/etcdserver/v3_server.go @@ -689,6 +689,7 @@ func (s *EtcdServer) linearizableReadLoop() { } 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) } + readIndexPending.Inc() } case <-time.After(s.Cfg.ReqTimeout()): if lg != nil {