adding evictions_total metric and marking evictions_number deprecated

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
cyclinder 2021-12-10 19:16:34 +08:00
parent cc6f12583f
commit b88b51c6e5
3 changed files with 25 additions and 2 deletions

View File

@ -29,6 +29,7 @@ const (
zoneSizeKey = "zone_size"
zoneNoUnhealthyNodesKey = "unhealthy_nodes_in_zone"
evictionsNumberKey = "evictions_number"
evictionsTotalKey = "evictions_total"
)
var (
@ -60,11 +61,21 @@ var (
[]string{"zone"},
)
evictionsNumber = metrics.NewCounterVec(
&metrics.CounterOpts{
Subsystem: nodeControllerSubsystem,
Name: evictionsNumberKey,
Help: "Number of Node evictions that happened since current instance of NodeController started, This metric is replaced by node_collector_evictions_total.",
DeprecatedVersion: "1.24.0",
StabilityLevel: metrics.ALPHA,
},
[]string{"zone"},
)
evictionsTotal = metrics.NewCounterVec(
&metrics.CounterOpts{
Subsystem: nodeControllerSubsystem,
Name: evictionsNumberKey,
Name: evictionsTotalKey,
Help: "Number of Node evictions that happened since current instance of NodeController started.",
StabilityLevel: metrics.ALPHA,
StabilityLevel: metrics.STABLE,
},
[]string{"zone"},
)
@ -79,5 +90,6 @@ func Register() {
legacyregistry.MustRegister(zoneSize)
legacyregistry.MustRegister(unhealthyNodes)
legacyregistry.MustRegister(evictionsNumber)
legacyregistry.MustRegister(evictionsTotal)
})
}

View File

@ -699,6 +699,7 @@ func (nc *Controller) doNoExecuteTaintingPass(ctx context.Context) {
//count the evictionsNumber
zone := nodetopology.GetZoneKey(node)
evictionsNumber.WithLabelValues(zone).Inc()
evictionsTotal.WithLabelValues(zone).Inc()
}
return result, 0
@ -742,6 +743,7 @@ func (nc *Controller) doEvictionPass(ctx context.Context) {
if node != nil {
zone := nodetopology.GetZoneKey(node)
evictionsNumber.WithLabelValues(zone).Inc()
evictionsTotal.WithLabelValues(zone).Inc()
}
return true, 0
@ -1396,6 +1398,7 @@ func (nc *Controller) addPodEvictorForNewZone(node *v1.Node) {
// Init the metric for the new zone.
klog.Infof("Initializing eviction metric for zone: %v", zone)
evictionsNumber.WithLabelValues(zone).Add(0)
evictionsTotal.WithLabelValues(zone).Add(0)
}
}

View File

@ -1,3 +1,11 @@
- name: evictions_total
subsystem: node_collector
help: Number of Node evictions that happened since current instance of NodeController
started.
type: Counter
stabilityLevel: STABLE
labels:
- zone
- name: framework_extension_point_duration_seconds
subsystem: scheduler
help: Latency for running all plugins of a specific extension point.