Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics,metrics: allow stats health to have finer granularity (#56475) #57092

Open
wants to merge 1 commit into
base: release-8.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions pkg/statistics/handle/cache/statscache.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,39 @@ func (s *StatsCacheImpl) SetStatsCacheCapacity(c int64) {

// UpdateStatsHealthyMetrics updates stats healthy distribution metrics according to stats cache.
func (s *StatsCacheImpl) UpdateStatsHealthyMetrics() {
<<<<<<< HEAD
distribution := make([]int64, 5)
=======
distribution := make([]int64, 9)
uneligibleAnalyze := 0
>>>>>>> c49fb9f8d80 (statistics,metrics: allow stats health to have finer granularity (#56475))
for _, tbl := range s.Values() {
healthy, ok := tbl.GetStatsHealthy()
if !ok {
continue
}
if healthy < 50 {
distribution[0]++
} else if healthy < 80 {
} else if healthy < 55 {
distribution[1]++
} else if healthy < 100 {
} else if healthy < 60 {
distribution[2]++
} else {
} else if healthy < 70 {
distribution[3]++
} else if healthy < 80 {
distribution[4]++
} else if healthy < 100 {
distribution[5]++
} else {
distribution[6]++
}
distribution[4]++
}
for i, val := range distribution {
handle_metrics.StatsHealthyGauges[i].Set(float64(val))
}
<<<<<<< HEAD
=======
handle_metrics.StatsHealthyGauges[8].Set(float64(uneligibleAnalyze))
>>>>>>> c49fb9f8d80 (statistics,metrics: allow stats health to have finer granularity (#56475))
}
5 changes: 4 additions & 1 deletion pkg/statistics/handle/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func init() {
func InitMetricsVars() {
StatsHealthyGauges = []prometheus.Gauge{
metrics.StatsHealthyGauge.WithLabelValues("[0,50)"),
metrics.StatsHealthyGauge.WithLabelValues("[50,80)"),
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
Expand Down