Merge pull request #115519 from sanposhiho/move-metric-recorder

cleanup(scheduler): move metricRecorder to metrics package
This commit is contained in:
Kubernetes Prow Robot
2023-02-16 03:57:38 -08:00
committed by GitHub
4 changed files with 102 additions and 125 deletions

View File

@@ -2829,7 +2829,7 @@ func TestPermitPlugins(t *testing.T) {
}
// withMetricsRecorder set metricsRecorder for the scheduling frameworkImpl.
func withMetricsRecorder(recorder *metricsRecorder) Option {
func withMetricsRecorder(recorder *metrics.MetricAsyncRecorder) Option {
return func(o *frameworkOptions) {
o.metricsRecorder = recorder
}
@@ -2985,7 +2985,7 @@ func TestRecordingMetrics(t *testing.T) {
}
stopCh := make(chan struct{})
recorder := newMetricsRecorder(100, time.Nanosecond, stopCh)
recorder := metrics.NewMetricsAsyncRecorder(100, time.Nanosecond, stopCh)
profile := config.KubeSchedulerProfile{
PercentageOfNodesToScore: pointer.Int32(testPercentageOfNodesToScore),
SchedulerName: testProfileName,
@@ -3001,9 +3001,9 @@ func TestRecordingMetrics(t *testing.T) {
// Stop the goroutine which records metrics and ensure it's stopped.
close(stopCh)
<-recorder.isStoppedCh
<-recorder.IsStoppedCh
// Try to clean up the metrics buffer again in case it's not empty.
recorder.flushMetrics()
recorder.FlushMetrics()
collectAndCompareFrameworkMetrics(t, tt.wantExtensionPoint, tt.wantStatus)
collectAndComparePluginMetrics(t, tt.wantExtensionPoint, testPlugin, tt.wantStatus)
@@ -3097,7 +3097,7 @@ func TestRunBindPlugins(t *testing.T) {
}
plugins := &config.Plugins{Bind: pluginSet}
stopCh := make(chan struct{})
recorder := newMetricsRecorder(100, time.Nanosecond, stopCh)
recorder := metrics.NewMetricsAsyncRecorder(100, time.Nanosecond, stopCh)
profile := config.KubeSchedulerProfile{
SchedulerName: testProfileName,
PercentageOfNodesToScore: pointer.Int32(testPercentageOfNodesToScore),
@@ -3116,9 +3116,9 @@ func TestRunBindPlugins(t *testing.T) {
// Stop the goroutine which records metrics and ensure it's stopped.
close(stopCh)
<-recorder.isStoppedCh
<-recorder.IsStoppedCh
// Try to clean up the metrics buffer again in case it's not empty.
recorder.flushMetrics()
recorder.FlushMetrics()
collectAndCompareFrameworkMetrics(t, "Bind", tt.wantStatus)
})
}