@@ -160,21 +160,24 @@ var (
160
160
values : metrics .ExtentionPoints ,
161
161
},
162
162
},
163
- "scheduler_queueing_hint_execution_duration_seconds" : {
164
- {
165
- label : pluginLabelName ,
166
- values : PluginNames ,
167
- },
168
- {
169
- label : eventLabelName ,
170
- values : schedframework .AllClusterEventLabels (),
171
- },
163
+ },
164
+ }
165
+
166
+ qHintMetrics = map [string ][]* labelValues {
167
+ "scheduler_queueing_hint_execution_duration_seconds" : {
168
+ {
169
+ label : pluginLabelName ,
170
+ values : PluginNames ,
172
171
},
173
- "scheduler_event_handling_duration_seconds" : {
174
- {
175
- label : eventLabelName ,
176
- values : schedframework .AllClusterEventLabels (),
177
- },
172
+ {
173
+ label : eventLabelName ,
174
+ values : schedframework .AllClusterEventLabels (),
175
+ },
176
+ },
177
+ "scheduler_event_handling_duration_seconds" : {
178
+ {
179
+ label : eventLabelName ,
180
+ values : schedframework .AllClusterEventLabels (),
178
181
},
179
182
},
180
183
}
@@ -245,6 +248,18 @@ func InitTests() error {
245
248
return logsapi .ValidateAndApply (LoggingConfig , LoggingFeatureGate )
246
249
}
247
250
251
+ func registerQHintMetrics () {
252
+ for k , v := range qHintMetrics {
253
+ defaultMetricsCollectorConfig .Metrics [k ] = v
254
+ }
255
+ }
256
+
257
+ func unregisterQHintMetrics () {
258
+ for k := range qHintMetrics {
259
+ delete (defaultMetricsCollectorConfig .Metrics , k )
260
+ }
261
+ }
262
+
248
263
// testCase defines a set of test cases that intends to test the performance of
249
264
// similar workloads of varying sizes with shared overall settings such as
250
265
// feature gates and metrics collected.
@@ -1056,7 +1071,6 @@ func setupTestCase(t testing.TB, tc *testCase, featureGates map[featuregate.Feat
1056
1071
if err := logsapi .ValidateAndApplyWithOptions (LoggingConfig , opts , LoggingFeatureGate ); err != nil {
1057
1072
t .Fatalf ("Failed to apply the per-test logging configuration: %v" , err )
1058
1073
}
1059
-
1060
1074
}
1061
1075
1062
1076
// Ensure that there are no leaked
@@ -1080,6 +1094,13 @@ func setupTestCase(t testing.TB, tc *testCase, featureGates map[featuregate.Feat
1080
1094
timeout := 30 * time .Minute
1081
1095
tCtx = ktesting .WithTimeout (tCtx , timeout , fmt .Sprintf ("timed out after the %s per-test timeout" , timeout ))
1082
1096
1097
+ if utilfeature .DefaultFeatureGate .Enabled (features .SchedulerQueueingHints ) {
1098
+ registerQHintMetrics ()
1099
+ t .Cleanup (func () {
1100
+ unregisterQHintMetrics ()
1101
+ })
1102
+ }
1103
+
1083
1104
return setupClusterForWorkload (tCtx , tc .SchedulerConfigPath , featureGates , outOfTreePluginRegistry )
1084
1105
}
1085
1106
@@ -1135,6 +1156,14 @@ func RunBenchmarkPerfScheduling(b *testing.B, configFile string, topicName strin
1135
1156
featureGates := featureGatesMerge (tc .FeatureGates , w .FeatureGates )
1136
1157
informerFactory , tCtx := setupTestCase (b , tc , featureGates , output , outOfTreePluginRegistry )
1137
1158
1159
+ // TODO(#93795): make sure each workload within a test case has a unique
1160
+ // name? The name is used to identify the stats in benchmark reports.
1161
+ // TODO(#94404): check for unused template parameters? Probably a typo.
1162
+ err := w .isValid (tc .MetricsCollectorConfig )
1163
+ if err != nil {
1164
+ b .Fatalf ("workload %s is not valid: %v" , w .Name , err )
1165
+ }
1166
+
1138
1167
results := runWorkload (tCtx , tc , w , informerFactory )
1139
1168
dataItems .DataItems = append (dataItems .DataItems , results ... )
1140
1169
@@ -1228,6 +1257,10 @@ func RunIntegrationPerfScheduling(t *testing.T, configFile string) {
1228
1257
}
1229
1258
featureGates := featureGatesMerge (tc .FeatureGates , w .FeatureGates )
1230
1259
informerFactory , tCtx := setupTestCase (t , tc , featureGates , nil , nil )
1260
+ err := w .isValid (tc .MetricsCollectorConfig )
1261
+ if err != nil {
1262
+ t .Fatalf ("workload %s is not valid: %v" , w .Name , err )
1263
+ }
1231
1264
1232
1265
runWorkload (tCtx , tc , w , informerFactory )
1233
1266
@@ -2145,15 +2178,6 @@ func validateTestCases(testCases []*testCase) error {
2145
2178
if ! tc .collectsMetrics () {
2146
2179
return fmt .Errorf ("%s: no op in the workload template collects metrics" , tc .Name )
2147
2180
}
2148
- // TODO(#93795): make sure each workload within a test case has a unique
2149
- // name? The name is used to identify the stats in benchmark reports.
2150
- // TODO(#94404): check for unused template parameters? Probably a typo.
2151
- for _ , w := range tc .Workloads {
2152
- err := w .isValid (tc .MetricsCollectorConfig )
2153
- if err != nil {
2154
- return err
2155
- }
2156
- }
2157
2181
}
2158
2182
return nil
2159
2183
}
0 commit comments