mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #87692 from everpeace/fix-scheduler-queue-metrics
Fix some scheduler metrics(pending_pods and schedule_attempts_total) are not recorded.
This commit is contained in:
commit
7f0ea141d2
@ -56,10 +56,13 @@ var (
|
|||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
}, []string{"result"})
|
}, []string{"result"})
|
||||||
// PodScheduleSuccesses counts how many pods were scheduled.
|
// PodScheduleSuccesses counts how many pods were scheduled.
|
||||||
|
// This metric will be initialized again in Register() to assure the metric is not no-op metric.
|
||||||
PodScheduleSuccesses = scheduleAttempts.With(metrics.Labels{"result": "scheduled"})
|
PodScheduleSuccesses = scheduleAttempts.With(metrics.Labels{"result": "scheduled"})
|
||||||
// PodScheduleFailures counts how many pods could not be scheduled.
|
// PodScheduleFailures counts how many pods could not be scheduled.
|
||||||
|
// This metric will be initialized again in Register() to assure the metric is not no-op metric.
|
||||||
PodScheduleFailures = scheduleAttempts.With(metrics.Labels{"result": "unschedulable"})
|
PodScheduleFailures = scheduleAttempts.With(metrics.Labels{"result": "unschedulable"})
|
||||||
// PodScheduleErrors counts how many pods could not be scheduled due to a scheduler error.
|
// PodScheduleErrors counts how many pods could not be scheduled due to a scheduler error.
|
||||||
|
// This metric will be initialized again in Register() to assure the metric is not no-op metric.
|
||||||
PodScheduleErrors = scheduleAttempts.With(metrics.Labels{"result": "error"})
|
PodScheduleErrors = scheduleAttempts.With(metrics.Labels{"result": "error"})
|
||||||
DeprecatedSchedulingDuration = metrics.NewSummaryVec(
|
DeprecatedSchedulingDuration = metrics.NewSummaryVec(
|
||||||
&metrics.SummaryOpts{
|
&metrics.SummaryOpts{
|
||||||
@ -262,6 +265,9 @@ func Register() {
|
|||||||
legacyregistry.MustRegister(metric)
|
legacyregistry.MustRegister(metric)
|
||||||
}
|
}
|
||||||
volumeschedulingmetrics.RegisterVolumeSchedulingMetrics()
|
volumeschedulingmetrics.RegisterVolumeSchedulingMetrics()
|
||||||
|
PodScheduleSuccesses = scheduleAttempts.With(metrics.Labels{"result": "scheduled"})
|
||||||
|
PodScheduleFailures = scheduleAttempts.With(metrics.Labels{"result": "unschedulable"})
|
||||||
|
PodScheduleErrors = scheduleAttempts.With(metrics.Labels{"result": "error"})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +291,8 @@ func New(client clientset.Interface,
|
|||||||
nodeInfoSnapshot: snapshot,
|
nodeInfoSnapshot: snapshot,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metrics.Register()
|
||||||
|
|
||||||
var sched *Scheduler
|
var sched *Scheduler
|
||||||
source := options.schedulerAlgorithmSource
|
source := options.schedulerAlgorithmSource
|
||||||
switch {
|
switch {
|
||||||
@ -322,7 +324,6 @@ func New(client clientset.Interface,
|
|||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported algorithm source: %v", source)
|
return nil, fmt.Errorf("unsupported algorithm source: %v", source)
|
||||||
}
|
}
|
||||||
metrics.Register()
|
|
||||||
// Additional tweaks to the config produced by the configurator.
|
// Additional tweaks to the config produced by the configurator.
|
||||||
sched.Recorder = recorder
|
sched.Recorder = recorder
|
||||||
sched.DisablePreemption = options.disablePreemption
|
sched.DisablePreemption = options.disablePreemption
|
||||||
|
Loading…
Reference in New Issue
Block a user