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:
Kubernetes Prow Robot 2023-06-07 06:18:13 -07:00 committed by GitHub
commit 2057a48ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -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) {

View File

@ -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,8 +95,11 @@ var (
label: extensionPointsLabelName, label: extensionPointsLabelName,
values: []string{"Filter", "Score"}, values: []string{"Filter", "Score"},
}, },
"scheduler_scheduling_attempt_duration_seconds": nil, "scheduler_scheduling_attempt_duration_seconds": {
"scheduler_pod_scheduling_duration_seconds": nil, label: resultLabelName,
values: []string{metrics.ScheduledResult, metrics.UnschedulableResult, metrics.ErrorResult},
},
"scheduler_pod_scheduling_duration_seconds": nil,
}, },
} }
) )