@@ -506,13 +506,13 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
506
506
// Pod did not fit anywhere, so it is counted as a failure. If preemption
507
507
// succeeds, the pod should get counted as a success the next time we try to
508
508
// schedule it. (hopefully)
509
- metrics .PodScheduleFailures . Inc ( )
509
+ metrics .PodUnschedulable ( prof . Name , metrics . SinceInSeconds ( start ) )
510
510
} else if err == core .ErrNoNodesAvailable {
511
511
// No nodes available is counted as unschedulable rather than an error.
512
- metrics .PodScheduleFailures . Inc ( )
512
+ metrics .PodUnschedulable ( prof . Name , metrics . SinceInSeconds ( start ) )
513
513
} else {
514
514
klog .ErrorS (err , "Error selecting node for pod" , "pod" , klog .KObj (pod ))
515
- metrics .PodScheduleErrors . Inc ( )
515
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
516
516
}
517
517
sched .recordSchedulingFailure (prof , podInfo , err , v1 .PodReasonUnschedulable , nominatedNode )
518
518
return
@@ -526,7 +526,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
526
526
// Run "reserve" plugins.
527
527
if sts := prof .RunReservePlugins (schedulingCycleCtx , state , assumedPod , scheduleResult .SuggestedHost ); ! sts .IsSuccess () {
528
528
sched .recordSchedulingFailure (prof , assumedPodInfo , sts .AsError (), SchedulerError , "" )
529
- metrics .PodScheduleErrors . Inc ( )
529
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
530
530
return
531
531
}
532
532
@@ -539,7 +539,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
539
539
// to a node and if so will not add it back to the unscheduled pods queue
540
540
// (otherwise this would cause an infinite loop).
541
541
sched .recordSchedulingFailure (prof , assumedPodInfo , err , SchedulerError , "" )
542
- metrics .PodScheduleErrors . Inc ( )
542
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
543
543
// trigger un-reserve plugins to clean up state associated with the reserved Pod
544
544
prof .RunUnreservePlugins (schedulingCycleCtx , state , assumedPod , scheduleResult .SuggestedHost )
545
545
return
@@ -550,10 +550,10 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
550
550
if runPermitStatus .Code () != framework .Wait && ! runPermitStatus .IsSuccess () {
551
551
var reason string
552
552
if runPermitStatus .IsUnschedulable () {
553
- metrics .PodScheduleFailures . Inc ( )
553
+ metrics .PodUnschedulable ( prof . Name , metrics . SinceInSeconds ( start ) )
554
554
reason = v1 .PodReasonUnschedulable
555
555
} else {
556
- metrics .PodScheduleErrors . Inc ( )
556
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
557
557
reason = SchedulerError
558
558
}
559
559
if forgetErr := sched .Cache ().ForgetPod (assumedPod ); forgetErr != nil {
@@ -576,10 +576,10 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
576
576
if ! waitOnPermitStatus .IsSuccess () {
577
577
var reason string
578
578
if waitOnPermitStatus .IsUnschedulable () {
579
- metrics .PodScheduleFailures . Inc ( )
579
+ metrics .PodUnschedulable ( prof . Name , metrics . SinceInSeconds ( start ) )
580
580
reason = v1 .PodReasonUnschedulable
581
581
} else {
582
- metrics .PodScheduleErrors . Inc ( )
582
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
583
583
reason = SchedulerError
584
584
}
585
585
if forgetErr := sched .Cache ().ForgetPod (assumedPod ); forgetErr != nil {
@@ -595,7 +595,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
595
595
preBindStatus := prof .RunPreBindPlugins (bindingCycleCtx , state , assumedPod , scheduleResult .SuggestedHost )
596
596
if ! preBindStatus .IsSuccess () {
597
597
var reason string
598
- metrics .PodScheduleErrors . Inc ( )
598
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
599
599
reason = SchedulerError
600
600
if forgetErr := sched .Cache ().ForgetPod (assumedPod ); forgetErr != nil {
601
601
klog .Errorf ("scheduler cache ForgetPod failed: %v" , forgetErr )
@@ -607,9 +607,8 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
607
607
}
608
608
609
609
err := sched .bind (bindingCycleCtx , prof , assumedPod , scheduleResult .SuggestedHost , state )
610
- metrics .E2eSchedulingLatency .Observe (metrics .SinceInSeconds (start ))
611
610
if err != nil {
612
- metrics .PodScheduleErrors . Inc ( )
611
+ metrics .PodScheduleError ( prof . Name , metrics . SinceInSeconds ( start ) )
613
612
// trigger un-reserve plugins to clean up state associated with the reserved Pod
614
613
prof .RunUnreservePlugins (bindingCycleCtx , state , assumedPod , scheduleResult .SuggestedHost )
615
614
sched .recordSchedulingFailure (prof , assumedPodInfo , fmt .Errorf ("Binding rejected: %v" , err ), SchedulerError , "" )
@@ -619,7 +618,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
619
618
klog .InfoS ("Successfully bound pod to node" , "pod" , klog .KObj (pod ), "node" , scheduleResult .SuggestedHost , "evaluatedNodes" , scheduleResult .EvaluatedNodes , "feasibleNodes" , scheduleResult .FeasibleNodes )
620
619
}
621
620
622
- metrics .PodScheduleSuccesses . Inc ( )
621
+ metrics .PodScheduled ( prof . Name , metrics . SinceInSeconds ( start ) )
623
622
metrics .PodSchedulingAttempts .Observe (float64 (podInfo .Attempts ))
624
623
metrics .PodSchedulingDuration .Observe (metrics .SinceInSeconds (podInfo .InitialAttemptTimestamp ))
625
624
0 commit comments