Fix division by zero, when total k6 operations is zero #64
2 changed files with 11 additions and 9 deletions
|
@ -100,7 +100,7 @@ class LoadReport:
|
||||||
|
|
||||||
return model_map[self.load_params.scenario]
|
return model_map[self.load_params.scenario]
|
||||||
|
|
||||||
def _get_oprations_sub_section_html(
|
def _get_operations_sub_section_html(
|
||||||
self,
|
self,
|
||||||
operation_type: str,
|
operation_type: str,
|
||||||
total_operations: int,
|
total_operations: int,
|
||||||
|
@ -132,7 +132,9 @@ class LoadReport:
|
||||||
model = self._get_model_string()
|
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
|
# 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"
|
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"""
|
html = f"""
|
||||||
<table border="1" cellpadding="5px"><tbody>
|
<table border="1" cellpadding="5px"><tbody>
|
||||||
<tr><th colspan="2" bgcolor="gainsboro">{short_summary}</th></tr>
|
<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>
|
<tr><th colspan="2" bgcolor="gainsboro">Errors</th></tr>
|
||||||
{per_node_errors_html}
|
{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}%")}
|
{self._row("Threshold", f"{self.load_params.error_threshold:.2f}%")}
|
||||||
</tbody></table><br><hr>
|
</tbody></table><br><hr>
|
||||||
"""
|
"""
|
||||||
|
@ -228,7 +230,7 @@ class LoadReport:
|
||||||
delete_errors[node_key] = metrics.delete_failed_iterations
|
delete_errors[node_key] = metrics.delete_failed_iterations
|
||||||
|
|
||||||
if write_section_required:
|
if write_section_required:
|
||||||
html += self._get_oprations_sub_section_html(
|
html += self._get_operations_sub_section_html(
|
||||||
"Write",
|
"Write",
|
||||||
write_operations,
|
write_operations,
|
||||||
requested_write_rate_str,
|
requested_write_rate_str,
|
||||||
|
@ -239,7 +241,7 @@ class LoadReport:
|
||||||
)
|
)
|
||||||
|
|
||||||
if read_section_required:
|
if read_section_required:
|
||||||
html += self._get_oprations_sub_section_html(
|
html += self._get_operations_sub_section_html(
|
||||||
"Read",
|
"Read",
|
||||||
read_operations,
|
read_operations,
|
||||||
requested_read_rate_str,
|
requested_read_rate_str,
|
||||||
|
@ -250,7 +252,7 @@ class LoadReport:
|
||||||
)
|
)
|
||||||
|
|
||||||
if delete_section_required:
|
if delete_section_required:
|
||||||
html += self._get_oprations_sub_section_html(
|
html += self._get_operations_sub_section_html(
|
||||||
"Delete",
|
"Delete",
|
||||||
delete_operations,
|
delete_operations,
|
||||||
requested_delete_rate_str,
|
requested_delete_rate_str,
|
||||||
|
|
|
@ -49,15 +49,15 @@ class LoadVerifier:
|
||||||
if deleters and not delete_operations:
|
if deleters and not delete_operations:
|
||||||
exceptions.append(f"No any delete operation was performed")
|
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(
|
exceptions.append(
|
||||||
f"Write error rate is greater than threshold: {write_errors / write_operations * 100} > {self.load_params.error_threshold}"
|
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(
|
exceptions.append(
|
||||||
f"Read error rate is greater than threshold: {read_errors / read_operations * 100} > {self.load_params.error_threshold}"
|
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(
|
exceptions.append(
|
||||||
f"Delete error rate is greater than threshold: {delete_errors / delete_operations * 100} > {self.load_params.error_threshold}"
|
f"Delete error rate is greater than threshold: {delete_errors / delete_operations * 100} > {self.load_params.error_threshold}"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue