From cf9533e34d22a45156d3cc56bb5a16defdc50a75 Mon Sep 17 00:00:00 2001 From: Robusta Runner Date: Sat, 2 Mar 2024 09:33:19 +0200 Subject: [PATCH] Fix bug that caused a fallback to loading pod names from the APIServer and not Prometheus --- .../prometheus/metrics_service/prometheus_metrics_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py index c628de7a..4b673094 100644 --- a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py +++ b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py @@ -190,6 +190,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> }}[{period_literal}] """ ) + replicasets = replicasets["result"] pod_owners = [replicaset["metric"]["replicaset"] for replicaset in replicasets] pod_owner_kind = "ReplicaSet" @@ -211,6 +212,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> ) """ ) + related_pods_result = related_pods_result["result"] if related_pods_result == []: return [] @@ -231,6 +233,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> }} == 1 """ ) + pods_status_result = pods_status_result["result"] current_pods_set |= {pod["metric"]["pod"] for pod in pods_status_result} del pods_status_result