Skip to content

Commit 5c7d834

Browse files
authored
Merge pull request kubernetes#131550 from ania-borowiec/patch-1
Add comment explaining the metric sampling logic for plugin execution metrics
2 parents 090ebab + 1b9386a commit 5c7d834

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/scheduler/schedule_one.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ func (sched *Scheduler) ScheduleOne(ctx context.Context) {
101101
// Synchronously attempt to find a fit for the pod.
102102
start := time.Now()
103103
state := framework.NewCycleState()
104+
// For the sake of performance, scheduler does not measure and export the scheduler_plugin_execution_duration metric
105+
// for every plugin execution in each scheduling cycle. Instead it samples a portion of scheduling cycles - percentage
106+
// determined by pluginMetricsSamplePercent. The line below helps to randomly pick appropriate scheduling cycles.
104107
state.SetRecordPluginMetrics(rand.Intn(100) < pluginMetricsSamplePercent)
105108

106109
// Initialize an empty podsToActivate struct, which will be filled up by plugins or stay empty.

0 commit comments

Comments
 (0)