Skip to content

Commit 94c51f0

Browse files
Present detailed tables broken down by regression/improvement and full view on github and cli
1 parent 64f8bff commit 94c51f0

File tree

2 files changed

+120
-36
lines changed

2 files changed

+120
-36
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.1.208"
3+
version = "0.1.209"
44
description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "Readme.md"

redis_benchmarks_specification/__compare__/compare.py

Lines changed: 119 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
from tqdm import tqdm
1717
import argparse
1818

19+
from io import StringIO
20+
import sys
21+
1922
from redis_benchmarks_specification.__common__.github import (
2023
update_comment_if_needed,
2124
create_new_pr_comment,
@@ -583,7 +586,11 @@ def compute_regression_table(
583586
)
584587
(
585588
detected_regressions,
586-
table,
589+
table_full,
590+
table_stable,
591+
table_unstable,
592+
table_improvements,
593+
table_regressions,
587594
total_improvements,
588595
total_regressions,
589596
total_stable,
@@ -619,35 +626,76 @@ def compute_regression_table(
619626
baseline_str, comparison_str
620627
)
621628
)
622-
writer = MarkdownTableWriter(
623-
table_name="Comparison between {} and {}.\n\nTime Period from {}. (environment used: {})\n".format(
624-
baseline_str,
625-
comparison_str,
626-
from_human_str,
627-
baseline_deployment_name,
628-
),
629+
630+
table_output = "# Comparison between {} and {}.\n\nTime Period from {}. (environment used: {})\n\n".format(
631+
baseline_str,
632+
comparison_str,
633+
from_human_str,
634+
baseline_deployment_name,
635+
)
636+
637+
if total_regressions > 0:
638+
old_stdout = sys.stdout
639+
sys.stdout = mystdout = StringIO()
640+
table_output += "#### Regressions Table\n\n"
641+
writer_regressions = MarkdownTableWriter(
642+
table_name="",
643+
headers=[
644+
"Test Case",
645+
"Baseline {} (median obs. +- std.dev)".format(baseline_str),
646+
"Comparison {} (median obs. +- std.dev)".format(comparison_str),
647+
"% change ({})".format(metric_mode),
648+
"Note",
649+
],
650+
value_matrix=table_regressions,
651+
)
652+
writer_regressions.dump(mystdout, False)
653+
table_output += mystdout.getvalue()
654+
table_output += "\n\n"
655+
mystdout.close()
656+
sys.stdout = old_stdout
657+
658+
if total_improvements > 0:
659+
old_stdout = sys.stdout
660+
sys.stdout = mystdout = StringIO()
661+
table_output += "#### Improvements Table\n\n"
662+
writer_regressions = MarkdownTableWriter(
663+
table_name="",
664+
headers=[
665+
"Test Case",
666+
"Baseline {} (median obs. +- std.dev)".format(baseline_str),
667+
"Comparison {} (median obs. +- std.dev)".format(comparison_str),
668+
"% change ({})".format(metric_mode),
669+
"Note",
670+
],
671+
value_matrix=table_improvements,
672+
)
673+
writer_regressions.dump(mystdout, False)
674+
table_output += mystdout.getvalue()
675+
table_output += "\n\n"
676+
mystdout.close()
677+
sys.stdout = old_stdout
678+
679+
old_stdout = sys.stdout
680+
sys.stdout = mystdout = StringIO()
681+
writer_full = MarkdownTableWriter(
682+
table_name="",
629683
headers=[
630684
"Test Case",
631685
"Baseline {} (median obs. +- std.dev)".format(baseline_str),
632686
"Comparison {} (median obs. +- std.dev)".format(comparison_str),
633687
"% change ({})".format(metric_mode),
634688
"Note",
635689
],
636-
value_matrix=table,
690+
value_matrix=table_full,
637691
)
638-
table_output = ""
639-
640-
from io import StringIO
641-
import sys
642-
643-
old_stdout = sys.stdout
644-
sys.stdout = mystdout = StringIO()
692+
table_output += "<details>\n <summary>Full Results table:</summary>\n\n"
645693

646-
writer.dump(mystdout, False)
694+
writer_full.dump(mystdout, False)
647695

648696
sys.stdout = old_stdout
649-
650-
table_output = mystdout.getvalue()
697+
table_output += mystdout.getvalue()
698+
table_output += "\n</details>\n"
651699

652700
return (
653701
detected_regressions,
@@ -742,7 +790,11 @@ def from_rts_to_regression_table(
742790
running_platform=None,
743791
):
744792
print_all = print_regressions_only is False and print_improvements_only is False
745-
table = []
793+
table_full = []
794+
table_unstable = []
795+
table_stable = []
796+
table_regressions = []
797+
table_improvements = []
746798
detected_regressions = []
747799
total_improvements = 0
748800
total_stable = 0
@@ -940,6 +992,25 @@ def from_rts_to_regression_table(
940992
total_unstable += 1
941993

942994
should_add_line = False
995+
line = get_line(
996+
baseline_v_str,
997+
comparison_v_str,
998+
note,
999+
percentage_change,
1000+
test_name,
1001+
)
1002+
if detected_regression:
1003+
table_regressions.append(line)
1004+
1005+
if detected_improvement:
1006+
table_improvements.append(line)
1007+
1008+
if unstable:
1009+
table_unstable.append(line)
1010+
else:
1011+
if not detected_regression and not detected_improvement:
1012+
table_stable.append(line)
1013+
9431014
if print_regressions_only and detected_regression:
9441015
should_add_line = True
9451016
if print_improvements_only and detected_improvement:
@@ -951,17 +1022,14 @@ def from_rts_to_regression_table(
9511022

9521023
if should_add_line:
9531024
total_comparison_points = total_comparison_points + 1
954-
add_line(
955-
baseline_v_str,
956-
comparison_v_str,
957-
note,
958-
percentage_change,
959-
table,
960-
test_name,
961-
)
1025+
table_full.append(line)
9621026
return (
9631027
detected_regressions,
964-
table,
1028+
table_full,
1029+
table_stable,
1030+
table_unstable,
1031+
table_improvements,
1032+
table_regressions,
9651033
total_improvements,
9661034
total_regressions,
9671035
total_stable,
@@ -1037,6 +1105,23 @@ def get_test_names_from_db(rts, tags_regex_string, test_names, used_key):
10371105
return test_names
10381106

10391107

1108+
def get_line(
1109+
baseline_v_str,
1110+
comparison_v_str,
1111+
note,
1112+
percentage_change,
1113+
test_name,
1114+
):
1115+
percentage_change_str = "{:.1f}% ".format(percentage_change)
1116+
return [
1117+
test_name,
1118+
baseline_v_str,
1119+
comparison_v_str,
1120+
percentage_change_str,
1121+
note.strip(),
1122+
]
1123+
1124+
10401125
def add_line(
10411126
baseline_v_str,
10421127
comparison_v_str,
@@ -1045,15 +1130,14 @@ def add_line(
10451130
table,
10461131
test_name,
10471132
):
1048-
percentage_change_str = "{:.1f}% ".format(percentage_change)
10491133
table.append(
1050-
[
1051-
test_name,
1134+
get_line(
10521135
baseline_v_str,
10531136
comparison_v_str,
1054-
percentage_change_str,
1055-
note.strip(),
1056-
]
1137+
note,
1138+
percentage_change,
1139+
test_name,
1140+
)
10571141
)
10581142

10591143

0 commit comments

Comments
 (0)