Add total bytes to report #186
3 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
|||
<tr><th colspan="2" bgcolor="gainsboro">Metrics</th></tr>
|
||||
{self._row("Total operations", stats.operations)}
|
||||
{self._row("OP/sec", f"{stats.rate:.2f}")}
|
||||
{bytes_html}
|
||||
{throughput_html}
|
||||
{latency_html}
|
||||
<tr><th colspan="2" bgcolor="gainsboro">Errors</th></tr>
|
||||
|
|
Loading…
Reference in a new issue