From 421d62267afb0877f858a73638de6714cf43d376 Mon Sep 17 00:00:00 2001 From: HunDunDM Date: Wed, 15 Sep 2021 21:03:22 +0800 Subject: [PATCH] tiny fix Signed-off-by: HunDunDM --- server/schedulers/hot_region.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/server/schedulers/hot_region.go b/server/schedulers/hot_region.go index e445e2ce947..06f4a59cd3b 100644 --- a/server/schedulers/hot_region.go +++ b/server/schedulers/hot_region.go @@ -340,18 +340,18 @@ func summaryStoresLoad( } } + expectLoads := make([]float64, len(allTiKVLoadSum)) + for i := range expectLoads { + expectLoads[i] = allTiKVLoadSum[i] / float64(allTiKVCount) + } + expect := storeLoad{ + Loads: expectLoads, + Count: float64(allTiKVHotPeersCount) / float64(allTiKVCount), + } + // store expectation byte/key rate and count for each store-load detail. for id, detail := range loadDetail { - var allLoadSum = allTiKVLoadSum - var allStoreCount = float64(allTiKVCount) - var allHotPeersCount = float64(allTiKVHotPeersCount) - expectLoads := make([]float64, len(allLoadSum)) - for i := range expectLoads { - expectLoads[i] = allLoadSum[i] / allStoreCount - } - expectCount := allHotPeersCount / allStoreCount - detail.LoadPred.Expect.Loads = expectLoads - detail.LoadPred.Expect.Count = expectCount + detail.LoadPred.Expect = expect // Debug { ty := "exp-byte-rate-" + rwTy.String() + "-" + kind.String() @@ -363,7 +363,7 @@ func summaryStoresLoad( } { ty := "exp-count-rate-" + rwTy.String() + "-" + kind.String() - hotPeerSummary.WithLabelValues(ty, fmt.Sprintf("%v", id)).Set(expectCount) + hotPeerSummary.WithLabelValues(ty, fmt.Sprintf("%v", id)).Set(expect.Count) } } return loadDetail