mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #114771 from sanposhiho/scheduling_perf_scheduler_scheduling_attempt_duration_seconds
feature(scheduler_perf): distinguish result in scheduler_scheduling_attempt_duration_seconds metric result
This commit is contained in:
		@@ -19,27 +19,27 @@ package metrics
 | 
				
			|||||||
// This file contains helpers for metrics that are associated to a profile.
 | 
					// This file contains helpers for metrics that are associated to a profile.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	scheduledResult     = "scheduled"
 | 
						ScheduledResult     = "scheduled"
 | 
				
			||||||
	unschedulableResult = "unschedulable"
 | 
						UnschedulableResult = "unschedulable"
 | 
				
			||||||
	errorResult         = "error"
 | 
						ErrorResult         = "error"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodScheduled can records a successful scheduling attempt and the duration
 | 
					// PodScheduled can records a successful scheduling attempt and the duration
 | 
				
			||||||
// since `start`.
 | 
					// since `start`.
 | 
				
			||||||
func PodScheduled(profile string, duration float64) {
 | 
					func PodScheduled(profile string, duration float64) {
 | 
				
			||||||
	observeScheduleAttemptAndLatency(scheduledResult, profile, duration)
 | 
						observeScheduleAttemptAndLatency(ScheduledResult, profile, duration)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodUnschedulable can records a scheduling attempt for an unschedulable pod
 | 
					// PodUnschedulable can records a scheduling attempt for an unschedulable pod
 | 
				
			||||||
// and the duration since `start`.
 | 
					// and the duration since `start`.
 | 
				
			||||||
func PodUnschedulable(profile string, duration float64) {
 | 
					func PodUnschedulable(profile string, duration float64) {
 | 
				
			||||||
	observeScheduleAttemptAndLatency(unschedulableResult, profile, duration)
 | 
						observeScheduleAttemptAndLatency(UnschedulableResult, profile, duration)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodScheduleError can records a scheduling attempt that had an error and the
 | 
					// PodScheduleError can records a scheduling attempt that had an error and the
 | 
				
			||||||
// duration since `start`.
 | 
					// duration since `start`.
 | 
				
			||||||
func PodScheduleError(profile string, duration float64) {
 | 
					func PodScheduleError(profile string, duration float64) {
 | 
				
			||||||
	observeScheduleAttemptAndLatency(errorResult, profile, duration)
 | 
						observeScheduleAttemptAndLatency(ErrorResult, profile, duration)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func observeScheduleAttemptAndLatency(result, profile string, duration float64) {
 | 
					func observeScheduleAttemptAndLatency(result, profile string, duration float64) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,6 +50,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
						"k8s.io/kubernetes/pkg/scheduler/apis/config"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
 | 
						"k8s.io/kubernetes/pkg/scheduler/apis/config/scheme"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
 | 
						"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
 | 
				
			||||||
 | 
						"k8s.io/kubernetes/pkg/scheduler/metrics"
 | 
				
			||||||
	"k8s.io/kubernetes/test/integration/framework"
 | 
						"k8s.io/kubernetes/test/integration/framework"
 | 
				
			||||||
	testutils "k8s.io/kubernetes/test/utils"
 | 
						testutils "k8s.io/kubernetes/test/utils"
 | 
				
			||||||
	"k8s.io/kubernetes/test/utils/ktesting"
 | 
						"k8s.io/kubernetes/test/utils/ktesting"
 | 
				
			||||||
@@ -84,6 +85,7 @@ const (
 | 
				
			|||||||
const (
 | 
					const (
 | 
				
			||||||
	configFile               = "config/performance-config.yaml"
 | 
						configFile               = "config/performance-config.yaml"
 | 
				
			||||||
	extensionPointsLabelName = "extension_point"
 | 
						extensionPointsLabelName = "extension_point"
 | 
				
			||||||
 | 
						resultLabelName          = "result"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@@ -93,7 +95,10 @@ var (
 | 
				
			|||||||
				label:  extensionPointsLabelName,
 | 
									label:  extensionPointsLabelName,
 | 
				
			||||||
				values: []string{"Filter", "Score"},
 | 
									values: []string{"Filter", "Score"},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			"scheduler_scheduling_attempt_duration_seconds": nil,
 | 
								"scheduler_scheduling_attempt_duration_seconds": {
 | 
				
			||||||
 | 
									label:  resultLabelName,
 | 
				
			||||||
 | 
									values: []string{metrics.ScheduledResult, metrics.UnschedulableResult, metrics.ErrorResult},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
			"scheduler_pod_scheduling_duration_seconds": nil,
 | 
								"scheduler_pod_scheduling_duration_seconds": nil,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user