From 1cb8a693de49043e3a6c377773f6bb85888923fe Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 7 Oct 2024 12:28:54 +0530 Subject: [PATCH] Use experiment type from kubernetes_object instead of constant --- .../recommendations/engine/RecommendationEngine.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/autotune/analyzer/recommendations/engine/RecommendationEngine.java b/src/main/java/com/autotune/analyzer/recommendations/engine/RecommendationEngine.java index 2a81e606e..8470adc58 100644 --- a/src/main/java/com/autotune/analyzer/recommendations/engine/RecommendationEngine.java +++ b/src/main/java/com/autotune/analyzer/recommendations/engine/RecommendationEngine.java @@ -1914,7 +1914,7 @@ private void fetchNamespaceMetricsBasedOnDataSourceAndProfile(KruizeObject kruiz } List namespaceMetricList = filterMetricsBasedOnExpType(metricProfile, - AnalyzerConstants.MetricName.namespaceMaxDate.name(),AnalyzerConstants.ExperimentTypes.NAMESPACE_EXPERIMENT); + AnalyzerConstants.MetricName.namespaceMaxDate.name(), kruizeObject.getExperimentType()); // Iterate over metrics and aggregation functions for (Metric metricEntry : namespaceMetricList) { @@ -2098,7 +2098,7 @@ private void fetchContainerMetricsBasedOnDataSourceAndProfile(KruizeObject kruiz MetricAggregationInfoResults metricAggregationInfoResults = null; List metricList = filterMetricsBasedOnExpType(metricProfile, - AnalyzerConstants.MetricName.maxDate.name(),AnalyzerConstants.ExperimentTypes.CONTAINER_EXPERIMENT); + AnalyzerConstants.MetricName.maxDate.name(), kruizeObject.getExperimentType()); List acceleratorFunctions = Arrays.asList( AnalyzerConstants.MetricName.gpuCoreUsage.toString(), @@ -2386,10 +2386,10 @@ public List filterMetricsBasedOnExpType(PerformanceProfile metricProfile .filter(Metric -> { String name = Metric.getName(); if (experimentType.equals(AnalyzerConstants.ExperimentTypes.NAMESPACE_EXPERIMENT)) { - // Include metrics that start with namespace and exclude namespaceMaxDate metric + // Include metrics that start with prefix "namespace" and exclude namespaceMaxDate metric return name.startsWith(namespace) && !name.equals(maxDateQuery); } else { - // Exclude metrics that start with namespace or maxDate metric + // Exclude metrics that start with prefix "namespace" and maxDate metric return !name.startsWith(namespace) && !name.equals(maxDateQuery); } })