Merge pull request #122001 from olderTaoist/scheduler-metric

report scheduling_algorithm_duration_seconds metric when pods is unschedulable
This commit is contained in:
Kubernetes Prow Robot 2023-12-14 05:09:25 +01:00 committed by GitHub
commit 6bd8f96f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,6 +148,9 @@ func (sched *Scheduler) schedulingCycle(
pod := podInfo.Pod
scheduleResult, err := sched.SchedulePod(ctx, fwk, state, pod)
if err != nil {
defer func() {
metrics.SchedulingAlgorithmLatency.Observe(metrics.SinceInSeconds(start))
}()
if err == ErrNoNodesAvailable {
status := framework.NewStatus(framework.UnschedulableAndUnresolvable).WithError(err)
return ScheduleResult{nominatingInfo: clearNominatedNode}, podInfo, status