Add promehteus metric about leader election status

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-03-10 19:12:33 -03:00
parent 476d0106d6
commit 7c717cabcf
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
4 changed files with 42 additions and 0 deletions

View file

@ -36,6 +36,9 @@ type Collector interface {
IncReloadCount()
IncReloadErrorCount()
OnStartedLeading(string)
OnStoppedLeading(string)
RemoveMetrics(ingresses, endpoints []string)
SetSSLExpireTime([]*ingress.Server)
@ -147,3 +150,13 @@ func (c *collector) SetSSLExpireTime(servers []*ingress.Server) {
func (c *collector) SetHosts(hosts sets.String) {
c.socket.SetHosts(hosts)
}
// OnStartedLeading indicates the pod is not the current leader
func (c *collector) OnStartedLeading(electionID string) {
c.ingressController.OnStartedLeading(electionID)
}
// OnStoppedLeading indicates the pod is not the current leader
func (c *collector) OnStoppedLeading(electionID string) {
c.ingressController.OnStoppedLeading(electionID)
}