diff options
| author | Avi-Robusta <97387909+Avi-Robusta@users.noreply.github.com> | 2023-05-29 11:58:44 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-29 11:58:44 +0300 |
| commit | 466dce562b48ce1f113eaa42db5d7a4df7228ea8 (patch) | |
| tree | a1fab0601cb9891378370b675cc971b83075bb57 | |
| parent | 110da668bee9f87e0f98a0e41ef32dee4984dddf (diff) | |
| parent | ea7d72868c2dac87879ea87e31b6a953c884c0b2 (diff) | |
Merge pull request #53 from robusta-dev/days_back_bug_fix
Fixed prometheus error
| -rw-r--r-- | robusta_krr/core/integrations/prometheus/loader.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/robusta_krr/core/integrations/prometheus/loader.py b/robusta_krr/core/integrations/prometheus/loader.py index 4e50626..68cade3 100644 --- a/robusta_krr/core/integrations/prometheus/loader.py +++ b/robusta_krr/core/integrations/prometheus/loader.py @@ -129,8 +129,10 @@ class PrometheusLoader(Configurable): if len(object.pods) == 0: return - - period_literal = f"{int(period.total_seconds()) // 60 // 24}d" + + # 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, query=f'kube_pod_owner{{pod="{next(iter(object.pods)).name}"}}[{period_literal}]', |
