diff --git a/app/api/routes.py b/app/api/routes.py index 0e2acb9..4d3fbcb 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -150,7 +150,7 @@ async def get_cluster_status( logger.info(f"Overcommit Debug - CPU Capacity: {cpu_capacity}, CPU Requests: {cpu_requests}, CPU Overcommit: {cpu_overcommit_percent}%") logger.info(f"Overcommit Debug - Memory Capacity: {memory_capacity}, Memory Requests: {memory_requests}, Memory Overcommit: {memory_overcommit_percent}%") - # Count namespaces in overcommit (simplified - count all namespaces) + # Count namespaces in overcommit namespaces_in_overcommit = len(namespaces_list) # Calculate resource utilization (usage vs requests) from Prometheus data @@ -158,9 +158,9 @@ async def get_cluster_status( if resource_utilization_info.get('data_source') == 'prometheus': resource_utilization = resource_utilization_info.get('overall_utilization_percent', 0) else: - # Fallback to simplified calculation if Prometheus data not available + # Use zero if Prometheus data not available if cpu_requests > 0 and memory_requests > 0: - resource_utilization = 75 # Placeholder fallback + resource_utilization = 0 # No data available # Return lightweight data for dashboard return { diff --git a/app/core/prometheus_client.py b/app/core/prometheus_client.py index c584457..3466b24 100644 --- a/app/core/prometheus_client.py +++ b/app/core/prometheus_client.py @@ -277,7 +277,7 @@ class PrometheusClient: return { 'status': 'healthy', 'prometheus_url': self.base_url, - 'response_time': 0.1 # Placeholder + 'response_time': 0.0 # No data available } else: return { diff --git a/app/static/index.html b/app/static/index.html index b39dd8b..bdaf3c8 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -2444,7 +2444,7 @@ // Calculate total CPU for percentages const totalCpu = data.reduce((sum, item) => sum + item.cpu_requests, 0); - // Create pie chart with labels directly on slices (like the original mock) + // Create pie chart with labels directly on slices let pieChartHtml = '