From 2f1729852028f67ceecd0f692b5b25683fbcfd9e Mon Sep 17 00:00:00 2001 From: avi robusta Date: Mon, 29 May 2023 11:37:33 +0300 Subject: Fixed prometheus error --- robusta_krr/core/integrations/prometheus/loader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/robusta_krr/core/integrations/prometheus/loader.py b/robusta_krr/core/integrations/prometheus/loader.py index 4e50626..93bc031 100644 --- a/robusta_krr/core/integrations/prometheus/loader.py +++ b/robusta_krr/core/integrations/prometheus/loader.py @@ -129,8 +129,9 @@ class PrometheusLoader(Configurable): if len(object.pods) == 0: return - - period_literal = f"{int(period.total_seconds()) // 60 // 24}d" + + days_literal = min(int(period.total_seconds()) // 60 // 24, 32) # the max can be 32 days + period_literal = f"{days_literal}d" owner = await asyncio.to_thread( self.prometheus.custom_query, query=f'kube_pod_owner{{pod="{next(iter(object.pods)).name}"}}[{period_literal}]', -- cgit v1.2.3 From ea7d72868c2dac87879ea87e31b6a953c884c0b2 Mon Sep 17 00:00:00 2001 From: avi robusta Date: Mon, 29 May 2023 11:57:36 +0300 Subject: comment fix --- robusta_krr/core/integrations/prometheus/loader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/robusta_krr/core/integrations/prometheus/loader.py b/robusta_krr/core/integrations/prometheus/loader.py index 93bc031..68cade3 100644 --- a/robusta_krr/core/integrations/prometheus/loader.py +++ b/robusta_krr/core/integrations/prometheus/loader.py @@ -130,7 +130,8 @@ class PrometheusLoader(Configurable): if len(object.pods) == 0: return - days_literal = min(int(period.total_seconds()) // 60 // 24, 32) # the max can be 32 days + # Prometheus limit, the max can be 32 days + days_literal = min(int(period.total_seconds()) // 60 // 24, 32) period_literal = f"{days_literal}d" owner = await asyncio.to_thread( self.prometheus.custom_query, -- cgit v1.2.3