summaryrefslogtreecommitdiff
path: root/robusta_krr/formatters/table.py
diff options
context:
space:
mode:
authorПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-03-13 18:19:29 +0200
committerПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-03-13 18:19:29 +0200
commitf3f0b6c5d515ff0cca06c96f4c7296eaf0343970 (patch)
treeeeac6fa58a2f82280951783802e46f258024d858 /robusta_krr/formatters/table.py
parent187db259c68ffafd5d0f2f8a71b902063ff0040b (diff)
Implement prometheus integration
Diffstat (limited to 'robusta_krr/formatters/table.py')
-rw-r--r--robusta_krr/formatters/table.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/robusta_krr/formatters/table.py b/robusta_krr/formatters/table.py
index 92711c4..9eda49e 100644
--- a/robusta_krr/formatters/table.py
+++ b/robusta_krr/formatters/table.py
@@ -10,6 +10,7 @@ from robusta_krr.core.models.result import ResourceScan, ResourceType, Result
from robusta_krr.utils import resource_units
NONE_LITERAL = "none"
+NAN_LITERAL = "?"
PRESCISION = 4
@@ -19,7 +20,12 @@ class TableFormatter(BaseFormatter):
__display_name__ = "table"
def _format_united_decimal(self, value: Decimal | None, prescision: int | None = None) -> str:
- return resource_units.format(value, prescision=prescision) if value is not None else NONE_LITERAL
+ if value is None:
+ return NONE_LITERAL
+ elif value.is_nan():
+ return NAN_LITERAL
+ else:
+ return resource_units.format(value, prescision=prescision)
def _format_request_str(self, item: ResourceScan, resource: ResourceType, selector: str) -> str:
return (