Skip to content
/ etcd Public
forked from etcd-io/etcd

Commit

Permalink
etcdserver: add leaseExpired metrics
Browse files Browse the repository at this point in the history
Fix etcd-io#8050.

Signed-off-by: Gyu-Ho Lee <[email protected]>
  • Loading branch information
gyuho committed Jun 8, 2017
1 parent eb36229 commit e631947
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions etcdserver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ var (
Name: "proposals_failed_total",
Help: "The total number of failed proposals seen.",
})
leaseExpired = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "server",
Name: "lease_expired_total",
Help: "The total number of expired lease.",
})
)

func init() {
Expand All @@ -67,6 +73,7 @@ func init() {
prometheus.MustRegister(proposalsApplied)
prometheus.MustRegister(proposalsPending)
prometheus.MustRegister(proposalsFailed)
prometheus.MustRegister(leaseExpired)
}

func monitorFileDescriptor(done <-chan struct{}) {
Expand Down
1 change: 1 addition & 0 deletions etcdserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ func (s *EtcdServer) run() {
s.goAttach(func() {
ctx := s.authStore.WithRoot(s.ctx)
s.LeaseRevoke(ctx, &pb.LeaseRevokeRequest{ID: int64(lid)})
leaseExpired.Inc()
<-c
})
}
Expand Down

0 comments on commit e631947

Please sign in to comment.