Skip to content

Commit d8c9190

Browse files
authored
statstics: fix wrong stats health metrics (#57555)
close #57176
1 parent 31c068c commit d8c9190

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

pkg/statistics/handle/cache/statscache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (s *StatsCacheImpl) UpdateStatsHealthyMetrics() {
261261
distribution := make([]int64, 9)
262262
uneligibleAnalyze := 0
263263
for _, tbl := range s.Values() {
264-
distribution[4]++ // total table count
264+
distribution[7]++ // total table count
265265
isEligibleForAnalysis := tbl.IsEligibleForAnalysis()
266266
if !isEligibleForAnalysis {
267267
uneligibleAnalyze++

pkg/statistics/handle/metrics/metrics.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ func init() {
3434
// InitMetricsVars init statistics metrics vars.
3535
func InitMetricsVars() {
3636
StatsHealthyGauges = []prometheus.Gauge{
37-
metrics.StatsHealthyGauge.WithLabelValues("[0,50)"),
38-
metrics.StatsHealthyGauge.WithLabelValues("[50,55)"),
39-
metrics.StatsHealthyGauge.WithLabelValues("[55,60)"),
40-
metrics.StatsHealthyGauge.WithLabelValues("[60,70)"),
41-
metrics.StatsHealthyGauge.WithLabelValues("[70,80)"),
42-
metrics.StatsHealthyGauge.WithLabelValues("[80,100)"),
43-
metrics.StatsHealthyGauge.WithLabelValues("[100,100]"),
44-
// [0,100] should always be the last
45-
metrics.StatsHealthyGauge.WithLabelValues("[0,100]"),
46-
metrics.StatsHealthyGauge.WithLabelValues("unneeded analyze"),
37+
metrics.StatsHealthyGauge.WithLabelValues("[0,50)"), // 0
38+
metrics.StatsHealthyGauge.WithLabelValues("[50,55)"), // 1
39+
metrics.StatsHealthyGauge.WithLabelValues("[55,60)"), // 2
40+
metrics.StatsHealthyGauge.WithLabelValues("[60,70)"), // 3
41+
metrics.StatsHealthyGauge.WithLabelValues("[70,80)"), // 4
42+
metrics.StatsHealthyGauge.WithLabelValues("[80,100)"), // 5
43+
metrics.StatsHealthyGauge.WithLabelValues("[100,100]"), // 6
44+
metrics.StatsHealthyGauge.WithLabelValues("[0,100]"), // 7
45+
metrics.StatsHealthyGauge.WithLabelValues("unneeded analyze"), // 8
4746
}
4847

4948
DumpHistoricalStatsSuccessCounter = metrics.HistoricalStatsCounter.WithLabelValues("dump", "success")

0 commit comments

Comments
 (0)