Skip to content

Commit

Permalink
Tracks elections
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlogic committed Jul 25, 2020
1 parent c1e6872 commit f98b8bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions goserverapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,14 @@ func (s *GoServer) registerServer(IP string, servername string, external bool, v
return r.GetService().Port, nil
}

var election = promauto.NewGauge(prometheus.GaugeOpts{
Name: "server_election",
Help: "The number of active election waits",
})

func (s *GoServer) runElection(key string, elected chan error, complete chan bool) {
election.Inc()
defer election.Dec()
command := exec.Command("etcdctl", "elect", s.Registry.Name+key, s.Registry.Identifier)
out, _ := command.StdoutPipe()
if out != nil {
Expand Down

0 comments on commit f98b8bc

Please sign in to comment.