summaryrefslogtreecommitdiff
path: root/robusta_krr
diff options
context:
space:
mode:
authorLeaveMyYard <zhukovpavel2001@gmail.com>2023-08-22 16:26:20 +0300
committerLeaveMyYard <zhukovpavel2001@gmail.com>2023-08-22 16:26:20 +0300
commit4d3ab4e92fb90fd34147fda85835e051f2e275a5 (patch)
treeebb8be21b63ecf2d1e613b7643885e030ceac334 /robusta_krr
parent357ce77e8419c6cb569accbaacd5470987217cfb (diff)
Small fix for points filtering
Diffstat (limited to 'robusta_krr')
-rw-r--r--robusta_krr/strategies/simple.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/robusta_krr/strategies/simple.py b/robusta_krr/strategies/simple.py
index 8cb8bfc..93efb5f 100644
--- a/robusta_krr/strategies/simple.py
+++ b/robusta_krr/strategies/simple.py
@@ -72,11 +72,12 @@ class SimpleStrategy(BaseStrategy[SimpleStrategySettings]):
self, history_data: MetricsPodData, object_data: K8sObjectData
) -> ResourceRecommendation:
data = history_data["PercentileCPULoader"]
- data_count = {pod: values[0, 1] for pod, values in history_data["CPUAmountLoader"].items()}
if len(data) == 0:
return ResourceRecommendation.undefined(info="No data")
+ data_count = {pod: values[0, 1] for pod, values in history_data["CPUAmountLoader"].items()}
+ # Here we filter out pods from calculation that have less than `points_required` data points
filtered_data = {
pod: values for pod, values in data.items() if data_count.get(pod, 0) >= self.settings.points_required
}
@@ -94,11 +95,12 @@ class SimpleStrategy(BaseStrategy[SimpleStrategySettings]):
self, history_data: MetricsPodData, object_data: K8sObjectData
) -> ResourceRecommendation:
data = history_data["MaxMemoryLoader"]
- data_count = {pod: values[0, 1] for pod, values in history_data["MemoryAmountLoader"].items()}
if len(data) == 0:
return ResourceRecommendation.undefined(info="No data")
+ data_count = {pod: values[0, 1] for pod, values in history_data["MemoryAmountLoader"].items()}
+ # Here we filter out pods from calculation that have less than `points_required` data points
filtered_data = {
pod: value for pod, value in data.items() if data_count.get(pod, 0) >= self.settings.points_required
}