@@ -35,9 +35,11 @@ type auditLogAnalyzer struct {
3535 latencyChecker * auditLatencyRecords
3636
3737 countsForInstall * CountsForRun
38+
39+ clusterStability monitortestframework.ClusterStabilityDuringTest
3840}
3941
40- func NewAuditLogAnalyzer () monitortestframework.MonitorTest {
42+ func NewAuditLogAnalyzer (info monitortestframework. MonitorTestInitializationInfo ) monitortestframework.MonitorTest {
4143 return & auditLogAnalyzer {
4244 summarizer : NewAuditLogSummarizer (),
4345 excessiveApplyChecker : CheckForExcessiveApplies (),
@@ -46,6 +48,7 @@ func NewAuditLogAnalyzer() monitortestframework.MonitorTest {
4648 violationChecker : CheckForViolations (),
4749 watchCountTracking : NewWatchCountTracking (),
4850 latencyChecker : CheckForLatency (),
51+ clusterStability : info .ClusterStabilityDuringTest ,
4952 }
5053}
5154
@@ -93,13 +96,16 @@ func (w *auditLogAnalyzer) CollectData(ctx context.Context, storageDir string, b
9396 w .invalidRequestsChecker ,
9497 w .requestsDuringShutdownChecker ,
9598 w .violationChecker ,
96- w .watchCountTracking ,
9799 w .latencyChecker ,
98100 }
99101 if w .requestCountTracking != nil {
100102 auditLogHandlers = append (auditLogHandlers , w .requestCountTracking )
101103 }
102104
105+ if w .clusterStability == monitortestframework .Stable {
106+ auditLogHandlers = append (auditLogHandlers , w .watchCountTracking )
107+ }
108+
103109 err = GetKubeAuditLogSummary (ctx , kubeClient , & beginning , & end , auditLogHandlers )
104110
105111 retIntervals := monitorapi.Intervals {}
@@ -411,10 +417,14 @@ func (w *auditLogAnalyzer) EvaluateTestsFromConstructedIntervals(ctx context.Con
411417 }
412418
413419 ret = append (ret , w .violationChecker .CreateJunits ()... )
414- junits , err := w .watchCountTracking .CreateJunits ()
415- if err == nil {
416- ret = append (ret , junits ... )
420+
421+ if w .clusterStability == monitortestframework .Stable {
422+ junits , err := w .watchCountTracking .CreateJunits ()
423+ if err == nil {
424+ ret = append (ret , junits ... )
425+ }
417426 }
427+
418428 return ret , err
419429}
420430
@@ -423,7 +433,7 @@ func (w *auditLogAnalyzer) WriteContentToStorage(ctx context.Context, storageDir
423433 return currErr
424434 }
425435
426- if w .watchCountTracking != nil {
436+ if w .watchCountTracking != nil && w . clusterStability == monitortestframework . Stable {
427437 err := w .watchCountTracking .WriteAuditLogSummary (ctx , storageDir , "watch-requests" , timeSuffix )
428438 if err != nil {
429439 // print any error and continue processing
0 commit comments