Fix scheduler performance regression after adding plugin metrics
This commit is contained in:
@@ -358,6 +358,20 @@ func NewFramework(r Registry, profile *config.KubeSchedulerProfile, stopCh <-cha
|
||||
options.captureProfile(outputProfile)
|
||||
}
|
||||
|
||||
// Cache metric streams for prefilter and filter plugins.
|
||||
for i, pl := range f.preFilterPlugins {
|
||||
f.preFilterPlugins[i] = &instrumentedPreFilterPlugin{
|
||||
PreFilterPlugin: f.preFilterPlugins[i],
|
||||
metric: metrics.PluginEvaluationTotal.WithLabelValues(pl.Name(), metrics.PreFilter, f.profileName),
|
||||
}
|
||||
}
|
||||
for i, pl := range f.filterPlugins {
|
||||
f.filterPlugins[i] = &instrumentedFilterPlugin{
|
||||
FilterPlugin: f.filterPlugins[i],
|
||||
metric: metrics.PluginEvaluationTotal.WithLabelValues(pl.Name(), metrics.Filter, f.profileName),
|
||||
}
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
|
||||
@@ -614,7 +628,6 @@ func (f *frameworkImpl) RunPreFilterPlugins(ctx context.Context, state *framewor
|
||||
skipPlugins.Insert(pl.Name())
|
||||
continue
|
||||
}
|
||||
metrics.PluginEvaluationTotal.WithLabelValues(pl.Name(), metrics.PreFilter, f.profileName).Inc()
|
||||
if !s.IsSuccess() {
|
||||
s.SetFailedPlugin(pl.Name())
|
||||
if s.IsUnschedulable() {
|
||||
@@ -732,7 +745,6 @@ func (f *frameworkImpl) RunFilterPlugins(
|
||||
if state.SkipFilterPlugins.Has(pl.Name()) {
|
||||
continue
|
||||
}
|
||||
metrics.PluginEvaluationTotal.WithLabelValues(pl.Name(), metrics.Filter, f.profileName).Inc()
|
||||
if status := f.runFilterPlugin(ctx, pl, state, pod, nodeInfo); !status.IsSuccess() {
|
||||
if !status.IsUnschedulable() {
|
||||
// Filter plugins are not supposed to return any status other than
|
||||
|
Reference in New Issue
Block a user