From 22b41b227fbddf0704f5529d24d85552ac08d340 Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Tue, 27 Feb 2024 11:57:54 +0300 Subject: [PATCH] [#186] Add total bytes to report Signed-off-by: Andrey Berezin --- src/frostfs_testlib/load/interfaces/summarized.py | 2 ++ src/frostfs_testlib/load/load_metrics.py | 4 ++++ src/frostfs_testlib/load/load_report.py | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/src/frostfs_testlib/load/interfaces/summarized.py b/src/frostfs_testlib/load/interfaces/summarized.py index a0059636..54947b46 100644 --- a/src/frostfs_testlib/load/interfaces/summarized.py +++ b/src/frostfs_testlib/load/interfaces/summarized.py @@ -50,6 +50,7 @@ class SummarizedStats: throughput: float = field(default_factory=float) latencies: SummarizedLatencies = field(default_factory=SummarizedLatencies) errors: SummarizedErorrs = field(default_factory=SummarizedErorrs) + total_bytes: int = field(default_factory=int) passed: bool = True def calc_stats(self): @@ -85,6 +86,7 @@ class SummarizedStats: target.latencies.by_node[node_key] = operation.latency target.throughput += operation.throughput target.errors.threshold = load_params.error_threshold + target.total_bytes = operation.total_bytes if operation.failed_iterations: target.errors.by_node[node_key] = operation.failed_iterations diff --git a/src/frostfs_testlib/load/load_metrics.py b/src/frostfs_testlib/load/load_metrics.py index 2dad3f6f..035ce8b4 100644 --- a/src/frostfs_testlib/load/load_metrics.py +++ b/src/frostfs_testlib/load/load_metrics.py @@ -39,6 +39,10 @@ class OperationMetric(ABC): def throughput(self) -> float: return self._get_metric_rate(self._THROUGHPUT) + @property + def total_bytes(self) -> float: + return self._get_metric(self._THROUGHPUT) + def _get_metric(self, metric: str) -> int: metrics_method_map = { "counter": self._get_counter_metric, diff --git a/src/frostfs_testlib/load/load_report.py b/src/frostfs_testlib/load/load_report.py index 22ddb540..2dfac26e 100644 --- a/src/frostfs_testlib/load/load_report.py +++ b/src/frostfs_testlib/load/load_report.py @@ -120,6 +120,11 @@ class LoadReport: throughput, unit = calc_unit(stats.throughput) throughput_html = self._row("Throughput", f"{throughput:.2f} {unit}/sec") + bytes_html = "" + if stats.total_bytes > 0: + total_bytes, total_bytes_unit = calc_unit(stats.total_bytes) + bytes_html = self._row("Total transferred", f"{total_bytes:.2f} {total_bytes_unit}") + per_node_errors_html = "" for node_key, errors in stats.errors.by_node.items(): if self.load_params.k6_process_allocation_strategy == K6ProcessAllocationStrategy.PER_ENDPOINT: @@ -148,6 +153,7 @@ class LoadReport: Metrics {self._row("Total operations", stats.operations)} {self._row("OP/sec", f"{stats.rate:.2f}")} + {bytes_html} {throughput_html} {latency_html} Errors