Skip to content

Commit

Permalink
statstics: fix wrong stats health metrics (pingcap#57555) (pingcap#57559
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Nov 20, 2024
1 parent fefd1ce commit a568fdc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/statistics/handle/cache/statscache.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (s *StatsCacheImpl) UpdateStatsHealthyMetrics() {
distribution := make([]int64, 9)
uneligibleAnalyze := 0
for _, tbl := range s.Values() {
distribution[4]++ // total table count
distribution[7]++ // total table count
isEligibleForAnalysis := tbl.IsEligibleForAnalysis()
if !isEligibleForAnalysis {
uneligibleAnalyze++
Expand Down
19 changes: 9 additions & 10 deletions pkg/statistics/handle/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ func init() {
// InitMetricsVars init statistics metrics vars.
func InitMetricsVars() {
StatsHealthyGauges = []prometheus.Gauge{
metrics.StatsHealthyGauge.WithLabelValues("[0,50)"),
metrics.StatsHealthyGauge.WithLabelValues("[50,55)"),
metrics.StatsHealthyGauge.WithLabelValues("[55,60)"),
metrics.StatsHealthyGauge.WithLabelValues("[60,70)"),
metrics.StatsHealthyGauge.WithLabelValues("[70,80)"),
metrics.StatsHealthyGauge.WithLabelValues("[80,100)"),
metrics.StatsHealthyGauge.WithLabelValues("[100,100]"),
// [0,100] should always be the last
metrics.StatsHealthyGauge.WithLabelValues("[0,100]"),
metrics.StatsHealthyGauge.WithLabelValues("unneeded analyze"),
metrics.StatsHealthyGauge.WithLabelValues("[0,50)"), // 0
metrics.StatsHealthyGauge.WithLabelValues("[50,55)"), // 1
metrics.StatsHealthyGauge.WithLabelValues("[55,60)"), // 2
metrics.StatsHealthyGauge.WithLabelValues("[60,70)"), // 3
metrics.StatsHealthyGauge.WithLabelValues("[70,80)"), // 4
metrics.StatsHealthyGauge.WithLabelValues("[80,100)"), // 5
metrics.StatsHealthyGauge.WithLabelValues("[100,100]"), // 6
metrics.StatsHealthyGauge.WithLabelValues("[0,100]"), // 7
metrics.StatsHealthyGauge.WithLabelValues("unneeded analyze"), // 8
}

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

0 comments on commit a568fdc

Please sign in to comment.