diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go index d6d4d4eade5..168f07024a7 100644 --- a/pkg/scheduler/framework/runtime/framework.go +++ b/pkg/scheduler/framework/runtime/framework.go @@ -969,10 +969,11 @@ func (f *frameworkImpl) RunPreScorePlugins( nodes []*v1.Node, ) (status *framework.Status) { startTime := time.Now() + skipPlugins := sets.New[string]() defer func() { + state.SkipScorePlugins = skipPlugins metrics.FrameworkExtensionPointDuration.WithLabelValues(metrics.PreScore, status.Code().String(), f.profileName).Observe(metrics.SinceInSeconds(startTime)) }() - skipPlugins := sets.New[string]() logger := klog.FromContext(ctx) logger = klog.LoggerWithName(logger, "PreScore") // TODO(knelasevero): Remove duplicated keys from log entry calls @@ -991,7 +992,6 @@ func (f *frameworkImpl) RunPreScorePlugins( return framework.AsStatus(fmt.Errorf("running PreScore plugin %q: %w", pl.Name(), status.AsError())) } } - state.SkipScorePlugins = skipPlugins return nil } diff --git a/pkg/scheduler/framework/runtime/framework_test.go b/pkg/scheduler/framework/runtime/framework_test.go index f09b55c5144..115411dc007 100644 --- a/pkg/scheduler/framework/runtime/framework_test.go +++ b/pkg/scheduler/framework/runtime/framework_test.go @@ -952,7 +952,8 @@ func TestRunPreScorePlugins(t *testing.T) { inj: injectedResult{PreScoreStatus: int(framework.Error)}, }, }, - wantStatusCode: framework.Error, + wantSkippedPlugins: sets.New("skip"), + wantStatusCode: framework.Error, }, { name: "all PreScore plugins returned skip",