fix divizion by zero, when total operations is zero
This commit is contained in:
parent
612e088763
commit
d6e08c477b
2 changed files with 11 additions and 9 deletions
|
@ -100,7 +100,7 @@ class LoadReport:
|
|||
|
||||
return model_map[self.load_params.scenario]
|
||||
|
||||
def _get_oprations_sub_section_html(
|
||||
def _get_operations_sub_section_html(
|
||||
self,
|
||||
operation_type: str,
|
||||
total_operations: int,
|
||||
|
@ -132,7 +132,9 @@ class LoadReport:
|
|||
model = self._get_model_string()
|
||||
# write 8KB 15h49m 50op/sec 50th open model/closed model/min_iteration duration=1s - 1.636MB/s 199.57451/s
|
||||
short_summary = f"{operation_type} {object_size}{object_size_unit} {duration} {requested_rate_str} {vus_str} {model} - {throughput:.2f}{unit}/s {total_rate:.2f}/s"
|
||||
|
||||
errors_percent = 0
|
||||
if total_operations:
|
||||
errors_percent = total_errors/total_operations*100.0
|
||||
html = f"""
|
||||
<table border="1" cellpadding="5px"><tbody>
|
||||
<tr><th colspan="2" bgcolor="gainsboro">{short_summary}</th></tr>
|
||||
|
@ -143,7 +145,7 @@ class LoadReport:
|
|||
|
||||
<tr><th colspan="2" bgcolor="gainsboro">Errors</th></tr>
|
||||
{per_node_errors_html}
|
||||
{self._row("Total", f"{total_errors} ({total_errors/total_operations*100.0:.2f}%)")}
|
||||
{self._row("Total", f"{total_errors} ({errors_percent:.2f}%)")}
|
||||
{self._row("Threshold", f"{self.load_params.error_threshold:.2f}%")}
|
||||
</tbody></table><br><hr>
|
||||
"""
|
||||
|
@ -228,7 +230,7 @@ class LoadReport:
|
|||
delete_errors[node_key] = metrics.delete_failed_iterations
|
||||
|
||||
if write_section_required:
|
||||
html += self._get_oprations_sub_section_html(
|
||||
html += self._get_operations_sub_section_html(
|
||||
"Write",
|
||||
write_operations,
|
||||
requested_write_rate_str,
|
||||
|
@ -239,7 +241,7 @@ class LoadReport:
|
|||
)
|
||||
|
||||
if read_section_required:
|
||||
html += self._get_oprations_sub_section_html(
|
||||
html += self._get_operations_sub_section_html(
|
||||
"Read",
|
||||
read_operations,
|
||||
requested_read_rate_str,
|
||||
|
@ -250,7 +252,7 @@ class LoadReport:
|
|||
)
|
||||
|
||||
if delete_section_required:
|
||||
html += self._get_oprations_sub_section_html(
|
||||
html += self._get_operations_sub_section_html(
|
||||
"Delete",
|
||||
delete_operations,
|
||||
requested_delete_rate_str,
|
||||
|
|
|
@ -49,15 +49,15 @@ class LoadVerifier:
|
|||
if deleters and not delete_operations:
|
||||
exceptions.append(f"No any delete operation was performed")
|
||||
|
||||
if writers and write_errors / write_operations * 100 > self.load_params.error_threshold:
|
||||
if write_operations and writers and write_errors / write_operations * 100 > self.load_params.error_threshold:
|
||||
exceptions.append(
|
||||
f"Write error rate is greater than threshold: {write_errors / write_operations * 100} > {self.load_params.error_threshold}"
|
||||
)
|
||||
if readers and read_errors / read_operations * 100 > self.load_params.error_threshold:
|
||||
if read_operations and readers and read_errors / read_operations * 100 > self.load_params.error_threshold:
|
||||
exceptions.append(
|
||||
f"Read error rate is greater than threshold: {read_errors / read_operations * 100} > {self.load_params.error_threshold}"
|
||||
)
|
||||
if deleters and delete_errors / delete_operations * 100 > self.load_params.error_threshold:
|
||||
if delete_operations and deleters and delete_errors / delete_operations * 100 > self.load_params.error_threshold:
|
||||
exceptions.append(
|
||||
f"Delete error rate is greater than threshold: {delete_errors / delete_operations * 100} > {self.load_params.error_threshold}"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue