diff --git a/etcdserver/metrics.go b/etcdserver/metrics.go index 2b549f738f7..90bbd3632a6 100644 --- a/etcdserver/metrics.go +++ b/etcdserver/metrics.go @@ -58,6 +58,12 @@ var ( Name: "proposals_failed_total", Help: "The total number of failed proposals seen.", }) + leaseExpired = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "etcd_debugging", + Subsystem: "server", + Name: "lease_expired_total", + Help: "The total number of expired leases.", + }) ) func init() { @@ -67,6 +73,7 @@ func init() { prometheus.MustRegister(proposalsApplied) prometheus.MustRegister(proposalsPending) prometheus.MustRegister(proposalsFailed) + prometheus.MustRegister(leaseExpired) } func monitorFileDescriptor(done <-chan struct{}) { diff --git a/etcdserver/server.go b/etcdserver/server.go index 6547f3f2e1a..f0de2e257e0 100644 --- a/etcdserver/server.go +++ b/etcdserver/server.go @@ -739,6 +739,7 @@ func (s *EtcdServer) run() { lid := lease.ID s.goAttach(func() { s.LeaseRevoke(s.ctx, &pb.LeaseRevokeRequest{ID: int64(lid)}) + leaseExpired.Inc() <-c }) }