Prettify verifier messages for error rates #146

Merged

View file

@ -44,22 +44,20 @@ class LoadVerifier:
if deleters and not delete_operations: if deleters and not delete_operations:
issues.append(f"No any delete operation was performed") issues.append(f"No any delete operation was performed")
if write_operations and writers and write_errors / write_operations * 100 > self.load_params.error_threshold: error_rate = self._get_error_rate(writers, write_operations, write_errors)
issues.append( if error_rate > self.load_params.error_threshold:
f"Write error rate is greater than threshold: {write_errors / write_operations * 100} > {self.load_params.error_threshold}" rate_str = self._get_rate_str(error_rate)
) issues.append(f"Write errors exceeded threshold: {rate_str} > {self.load_params.error_threshold}%")
if read_operations and readers and read_errors / read_operations * 100 > self.load_params.error_threshold:
issues.append( error_rate = self._get_error_rate(readers, read_operations, read_errors)
f"Read error rate is greater than threshold: {read_errors / read_operations * 100} > {self.load_params.error_threshold}" if error_rate > self.load_params.error_threshold:
) rate_str = self._get_rate_str(error_rate)
if ( issues.append(f"Read errors exceeded threshold: {rate_str} > {self.load_params.error_threshold}%")
delete_operations
and deleters error_rate = self._get_error_rate(deleters, delete_operations, delete_errors)
and delete_errors / delete_operations * 100 > self.load_params.error_threshold if error_rate > self.load_params.error_threshold:
): rate_str = self._get_rate_str(error_rate)
issues.append( issues.append(f"Delete errors exceeded threshold: {rate_str} > {self.load_params.error_threshold}%")
f"Delete error rate is greater than threshold: {delete_errors / delete_operations * 100} > {self.load_params.error_threshold}"
)
return issues return issues
@ -76,6 +74,16 @@ class LoadVerifier:
) )
return verify_issues return verify_issues
def _get_error_rate(self, vus: int, operations: int, errors: int) -> float:
if not operations or not vus:
return 0
error_rate = errors / operations * 100
return error_rate
def _get_rate_str(self, rate: float, minimal: float = 0.01) -> str:
return f"{rate:.2f}%" if rate >= minimal else f"~{minimal}%"
def _collect_verify_issues_on_process(self, label, load_summary, verification_summary) -> list[str]: def _collect_verify_issues_on_process(self, label, load_summary, verification_summary) -> list[str]:
issues = [] issues = []