Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Oct 6, 2023
1 parent db6442e commit e98f138
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,6 @@ def _create_stop_writes_entry(
node_sw_metrics[(namespace, set_, metric)] = entry


@staticmethod
def _is_stop_writes_cause(
usage: int | float,
threshold: int | float,
Expand All @@ -1671,13 +1670,12 @@ def _is_stop_writes_cause(
)


@staticmethod
def _get_first_value_from_dict_with_key(
dict_: dict[str, Any],
key: str | tuple,
default_value: Any = None,
return_type: type = str,
) -> Any:
) -> tuple[Any, Any]:
if isinstance(key, str):
key = (key,)

Expand All @@ -1690,7 +1688,6 @@ def _get_first_value_from_dict_with_key(
return None, None


@staticmethod
def _format_ns_stop_writes_metrics(
stop_writes_metrics: StopWritesDict,
service_stats,
Expand Down Expand Up @@ -1796,7 +1793,7 @@ def _format_ns_stop_writes_metrics(
return_type=int,
)

if metric and usage is not None and threshold is not None:
if usage is not None and threshold is not None:
sw = _is_stop_writes_cause(usage, threshold, stop_writes, invert=True)
_create_stop_writes_entry(
stop_writes_metrics[node],
Expand Down Expand Up @@ -1853,7 +1850,7 @@ def _format_ns_stop_writes_metrics(
)

if usage is not None and threshold is not None and bytes_total is not None:
threshold = int(bytes_total) * (int(threshold) / 100)
threshold = bytes_total * (threshold / 100)
sw = _is_stop_writes_cause(usage, threshold, stop_writes)
_create_stop_writes_entry(
stop_writes_metrics[node],
Expand Down

0 comments on commit e98f138

Please sign in to comment.