From 50616a10ac71171fe16bf3c0d234150b7d67084d Mon Sep 17 00:00:00 2001 From: bharathappali Date: Mon, 18 Sep 2023 17:56:04 +0530 Subject: [PATCH] Adds threshold for limit rows to make sure duration in mins is covered for long term Signed-off-by: bharathappali --- .../ResourceOptimizationOpenshiftImpl.java | 12 ++++++++---- .../recommendations/utils/RecommendationUtils.java | 8 ++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/autotune/analyzer/performanceProfiles/PerformanceProfileInterface/ResourceOptimizationOpenshiftImpl.java b/src/main/java/com/autotune/analyzer/performanceProfiles/PerformanceProfileInterface/ResourceOptimizationOpenshiftImpl.java index 8239e6c10..2d9758d39 100644 --- a/src/main/java/com/autotune/analyzer/performanceProfiles/PerformanceProfileInterface/ResourceOptimizationOpenshiftImpl.java +++ b/src/main/java/com/autotune/analyzer/performanceProfiles/PerformanceProfileInterface/ResourceOptimizationOpenshiftImpl.java @@ -94,26 +94,30 @@ public void generateRecommendation(KruizeObject kruizeObject, List mainKruizeExperimentMap = new HashMap<>(); mainKruizeExperimentMap.put(experiment_name, kruizeObject); new ExperimentDBService().loadResultsFromDBByName(mainKruizeExperimentMap, experiment_name, interval_end_time, - limitRows); + practicalLimitRows); //TODO: Will be updated once algo is completed for (ExperimentResultData experimentResultData : experimentResultDataList) { if (null != kruizeObject && null != experimentResultData) { diff --git a/src/main/java/com/autotune/analyzer/recommendations/utils/RecommendationUtils.java b/src/main/java/com/autotune/analyzer/recommendations/utils/RecommendationUtils.java index dceadcfb5..638407c10 100644 --- a/src/main/java/com/autotune/analyzer/recommendations/utils/RecommendationUtils.java +++ b/src/main/java/com/autotune/analyzer/recommendations/utils/RecommendationUtils.java @@ -160,4 +160,12 @@ public static RecommendationNotification getNotificationForTermAvailability(Reco } return recommendationNotification; } + + public static int getThreshold(int value, int failoverPercentage, boolean direction) { + if (direction) { + return Math.round(value + value * (failoverPercentage / 100.0f)); + } else { + return Math.round(value - value * (failoverPercentage / 100.0f)); + } + } }