Skip to content

Commit

Permalink
Bug fix - thank you @deutschj
Browse files Browse the repository at this point in the history
  • Loading branch information
aantn committed Jun 14, 2024
1 parent 73eb5f3 commit 24af7f5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ def __init__(self) -> None:
self.prometheus.connect(settings.prometheus_url)

async def list_clusters(self) -> Optional[list[str]]:
if settings.prometheus_cluster_label is None:
if settings.prometheus_label is None:
logger.info("Assuming that Prometheus contains only one cluster.")
logger.info("If you have multiple clusters in Prometheus, please provide the `-l` flag.")
return None

clusters = await self.prometheus.loader.query(
f"""
avg by({settings.prometheus_cluster_label}) (
avg by({settings.prometheus_label}) (
kube_pod_container_resource_limits
)
"""
)

return [cluster["metric"][settings.prometheus_cluster_label] for cluster in clusters]
return [cluster["metric"][settings.prometheus_label] for cluster in clusters]

@cache
def get_workload_loader(self, cluster: str) -> PrometheusWorkloadLoader:
Expand Down

0 comments on commit 24af7f5

Please # to comment.