Merge pull request #128810 from googs1025/cleanup/scheduler/metrics

chore: remove repeated scheduler prefix metrics for CacheSizeMetrics
This commit is contained in:
Kubernetes Prow Robot 2024-12-12 04:12:32 +00:00 committed by GitHub
commit 6c108faaf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 3 deletions

View File

@ -757,4 +757,12 @@ func (cache *cacheImpl) updateMetrics() {
metrics.CacheSize.WithLabelValues("assumed_pods").Set(float64(len(cache.assumedPods)))
metrics.CacheSize.WithLabelValues("pods").Set(float64(len(cache.podStates)))
metrics.CacheSize.WithLabelValues("nodes").Set(float64(len(cache.nodes)))
// we intentionally keep them with the deprecation and will remove at v1.33.
//nolint:staticcheck
metrics.SchedulerCacheSize.WithLabelValues("assumed_pods").Set(float64(len(cache.assumedPods)))
//nolint:staticcheck
metrics.SchedulerCacheSize.WithLabelValues("pods").Set(float64(len(cache.podStates)))
//nolint:staticcheck
metrics.SchedulerCacheSize.WithLabelValues("nodes").Set(float64(len(cache.nodes)))
}

View File

@ -110,8 +110,11 @@ var (
FrameworkExtensionPointDuration *metrics.HistogramVec
PluginExecutionDuration *metrics.HistogramVec
PermitWaitDuration *metrics.HistogramVec
CacheSize *metrics.GaugeVec
PermitWaitDuration *metrics.HistogramVec
CacheSize *metrics.GaugeVec
// Deprecated: SchedulerCacheSize is deprecated,
// and will be removed at v1.33. Please use CacheSize instead.
SchedulerCacheSize *metrics.GaugeVec
unschedulableReasons *metrics.GaugeVec
PluginEvaluationTotal *metrics.CounterVec
@ -308,10 +311,19 @@ func InitMetrics() {
},
[]string{"result"})
SchedulerCacheSize = metrics.NewGaugeVec(
&metrics.GaugeOpts{
Subsystem: SchedulerSubsystem,
Name: "scheduler_cache_size",
Help: "Number of nodes, pods, and assumed (bound) pods in the scheduler cache.",
StabilityLevel: metrics.ALPHA,
DeprecatedVersion: "1.33.0",
}, []string{"type"})
CacheSize = metrics.NewGaugeVec(
&metrics.GaugeOpts{
Subsystem: SchedulerSubsystem,
Name: "scheduler_cache_size",
Name: "cache_size",
Help: "Number of nodes, pods, and assumed (bound) pods in the scheduler cache.",
StabilityLevel: metrics.ALPHA,
}, []string{"type"})
@ -368,6 +380,7 @@ func InitMetrics() {
Goroutines,
PermitWaitDuration,
CacheSize,
SchedulerCacheSize,
unschedulableReasons,
PluginEvaluationTotal,
}