Skip to content

Commit

Permalink
fix the error of cluster status duration statistics. (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyjhtangtang authored May 10, 2021
1 parent fad779e commit 701d65e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/yurthub/healthchecker/health_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ func (c *checker) check() bool {
if !c.isHealthy() && c.healthyCnt >= c.healthyThreshold {
c.setHealthy(true)
now := time.Now()
c.lastTime = now
klog.Infof("cluster becomes healthy from %v, unhealthy status lasts %v, remote server: %v", now, now.Sub(c.lastTime), c.remoteServer.String())
c.lastTime = now
metrics.Metrics.ObserveServerHealthy(c.remoteServer.Host, 1)
}
return true
Expand All @@ -217,8 +217,8 @@ func (c *checker) check() bool {
if c.isHealthy() {
c.setHealthy(false)
now := time.Now()
c.lastTime = now
klog.Infof("cluster becomes unhealthy from %v, healthy status lasts %v, remote server: %v", time.Now(), now.Sub(c.lastTime), c.remoteServer.String())
c.lastTime = now
if c.onFailureFunc != nil {
c.onFailureFunc(c.remoteServer.Host)
}
Expand Down

0 comments on commit 701d65e

Please sign in to comment.