From ff94e2beb44e6ee60a981c543f85dc74b67289fd Mon Sep 17 00:00:00 2001 From: "bingchang.tbc" Date: Mon, 10 May 2021 20:53:10 +0800 Subject: [PATCH] fix the error of cluster status duration statistics. --- pkg/yurthub/healthchecker/health_checker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/yurthub/healthchecker/health_checker.go b/pkg/yurthub/healthchecker/health_checker.go index 03639ce446b..3aa42af3edf 100644 --- a/pkg/yurthub/healthchecker/health_checker.go +++ b/pkg/yurthub/healthchecker/health_checker.go @@ -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 @@ -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) }