diff options
| author | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-03-20 20:21:42 +0200 |
|---|---|---|
| committer | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-03-20 20:21:42 +0200 |
| commit | 07a1bb1dc504dac31bfe17d68e72981c1c2a045a (patch) | |
| tree | c526198179e538ed8ec66ca5145916c7f3f2bda8 /robusta_krr/formatters/table.py | |
| parent | f3f0b6c5d515ff0cca06c96f4c7296eaf0343970 (diff) | |
Fix prometheus integration
Diffstat (limited to 'robusta_krr/formatters/table.py')
| -rw-r--r-- | robusta_krr/formatters/table.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/robusta_krr/formatters/table.py b/robusta_krr/formatters/table.py index 9eda49e..327d66a 100644 --- a/robusta_krr/formatters/table.py +++ b/robusta_krr/formatters/table.py @@ -12,6 +12,7 @@ from robusta_krr.utils import resource_units NONE_LITERAL = "none" NAN_LITERAL = "?" PRESCISION = 4 +ALLOWED_DIFFERENCE = 0.05 class TableFormatter(BaseFormatter): @@ -28,10 +29,13 @@ class TableFormatter(BaseFormatter): return resource_units.format(value, prescision=prescision) def _format_request_str(self, item: ResourceScan, resource: ResourceType, selector: str) -> str: + allocated = getattr(item.object.allocations, selector)[resource] + recommended = getattr(item.recommended, selector)[resource] + return ( - self._format_united_decimal(getattr(item.object.allocations, selector)[resource]) + self._format_united_decimal(allocated) + " -> " - + self._format_united_decimal(getattr(item.recommended, selector)[resource], prescision=PRESCISION) + + self._format_united_decimal(recommended, prescision=PRESCISION) ) def format(self, result: Result) -> Table: @@ -49,6 +53,7 @@ class TableFormatter(BaseFormatter): table.add_column("Cluster", style="cyan") table.add_column("Namespace", style="cyan") table.add_column("Name", style="cyan") + table.add_column("Pods", style="cyan") table.add_column("Type", style="cyan") table.add_column("Container", style="cyan") for resource in ResourceType: @@ -69,6 +74,7 @@ class TableFormatter(BaseFormatter): item.object.cluster if full_info_row else "", item.object.namespace if full_info_row else "", item.object.name if full_info_row else "", + str(len(item.object.pods)) if full_info_row else "", item.object.kind if full_info_row else "", item.object.container, *[ |
