From 701d65ead8f95520e9f5bb02615cbed99b2ca9cd Mon Sep 17 00:00:00 2001 From: zyjhtangtang Date: Tue, 11 May 2021 00:34:36 +0800 Subject: [PATCH] fix the error of cluster status duration statistics. (#295) --- 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) }