From d2b63de68401e63c913783016487f74b350445f8 Mon Sep 17 00:00:00 2001 From: Avi-Robusta <97387909+Avi-Robusta@users.noreply.github.com> Date: Wed, 24 Jul 2024 11:56:53 +0300 Subject: [PATCH] increasing batch size (#318) --- .../prometheus/metrics_service/prometheus_metrics_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 44bbadb1..c93cf35e 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 @@ -1,5 +1,6 @@ import asyncio import logging +import os from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta from typing import Iterable, List, Optional, Dict, Any @@ -314,7 +315,8 @@ async def load_pods(self, object: K8sObjectData, period: timedelta) -> list[PodD pod_owner_kind = object.kind related_pods_result = [] - for owner_group in batched(pod_owners, 10): + batch_size = int(os.environ.get("KRR_OWNER_BATCH_SIZE", 100)) + for owner_group in batched(pod_owners, batch_size): owners_regex = "|".join(owner_group) related_pods_result_item = await self.query( f"""