mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	adding evictions_total metric and marking evictions_number deprecated
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
		@@ -29,6 +29,7 @@ const (
 | 
			
		||||
	zoneSizeKey             = "zone_size"
 | 
			
		||||
	zoneNoUnhealthyNodesKey = "unhealthy_nodes_in_zone"
 | 
			
		||||
	evictionsNumberKey      = "evictions_number"
 | 
			
		||||
	evictionsTotalKey       = "evictions_total"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -63,11 +64,21 @@ var (
 | 
			
		||||
		&metrics.CounterOpts{
 | 
			
		||||
			Subsystem:         nodeControllerSubsystem,
 | 
			
		||||
			Name:              evictionsNumberKey,
 | 
			
		||||
			Help:           "Number of Node evictions that happened since current instance of NodeController started.",
 | 
			
		||||
			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:           evictionsTotalKey,
 | 
			
		||||
			Help:           "Number of Node evictions that happened since current instance of NodeController started.",
 | 
			
		||||
			StabilityLevel: metrics.STABLE,
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"zone"},
 | 
			
		||||
	)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var registerMetrics sync.Once
 | 
			
		||||
@@ -79,5 +90,6 @@ func Register() {
 | 
			
		||||
		legacyregistry.MustRegister(zoneSize)
 | 
			
		||||
		legacyregistry.MustRegister(unhealthyNodes)
 | 
			
		||||
		legacyregistry.MustRegister(evictionsNumber)
 | 
			
		||||
		legacyregistry.MustRegister(evictionsTotal)
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user