Skip to content

Commit c64a62d

Browse files
Merge pull request #449 from redis-performance/arch.fix
Ensuring architecture is present on metadata across all timeseries
2 parents ca36b29 + 5a1431e commit c64a62d

File tree

6 files changed

+117
-36
lines changed

6 files changed

+117
-36
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.11.32"
3+
version = "0.11.35"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/compare/args.py

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ def create_compare_arguments(parser):
9292
default=1,
9393
help="Use the last N samples for each time-serie. by default will use last value only",
9494
)
95+
parser.add_argument(
96+
"--first_n_baseline",
97+
type=int,
98+
default=-1,
99+
help="Use the last N samples for each time-serie. by default will use last 7 available values",
100+
)
101+
parser.add_argument(
102+
"--first_n_comparison",
103+
type=int,
104+
default=-1,
105+
help="Use the last N samples for each time-serie. by default will use last value only",
106+
)
95107
parser.add_argument(
96108
"--from-date",
97109
type=lambda s: datetime.datetime.strptime(s, "%Y-%m-%d"),

redisbench_admin/compare/compare.py

+50-7
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,31 @@ def compare_command_logic(args, project_name, project_version):
135135
last_n_baseline = args.last_n_baseline
136136
if last_n_comparison < 0:
137137
last_n_comparison = args.last_n_comparison
138-
logging.info("Using last {} samples for baseline analysis".format(last_n_baseline))
139-
logging.info(
140-
"Using last {} samples for comparison analysis".format(last_n_comparison)
141-
)
138+
first_n_baseline = args.first_n_baseline
139+
first_n_comparison = args.first_n_comparison
140+
# Log the interval of values considered
141+
if first_n_baseline >= 0:
142+
logging.info(
143+
"Using samples in the range [{}:{}] for baseline analysis".format(
144+
first_n_baseline, last_n_baseline
145+
)
146+
)
147+
else:
148+
logging.info(
149+
"Using last {} samples for baseline analysis".format(last_n_baseline)
150+
)
151+
152+
if first_n_comparison >= 0:
153+
logging.info(
154+
"Using samples in the range [{}:{}] for comparison analysis".format(
155+
first_n_comparison, last_n_comparison
156+
)
157+
)
158+
else:
159+
logging.info(
160+
"Using last {} samples for comparison analysis".format(last_n_comparison)
161+
)
162+
142163
verbose = args.verbose
143164
regressions_percent_lower_limit = args.regressions_percent_lower_limit
144165
metric_name = args.metric_name
@@ -280,6 +301,8 @@ def compare_command_logic(args, project_name, project_version):
280301
running_platform,
281302
baseline_architecture,
282303
comparison_architecture,
304+
first_n_baseline,
305+
first_n_comparison,
283306
)
284307
comment_body = ""
285308
if total_comparison_points > 0:
@@ -506,6 +529,8 @@ def compute_regression_table(
506529
running_platform=None,
507530
baseline_architecture=ARCH_X86,
508531
comparison_architecture=ARCH_X86,
532+
first_n_baseline=-1,
533+
first_n_comparison=-1,
509534
):
510535
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
511536
START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=31)
@@ -594,6 +619,8 @@ def compute_regression_table(
594619
running_platform,
595620
baseline_architecture,
596621
comparison_architecture,
622+
first_n_baseline,
623+
first_n_comparison,
597624
)
598625
logging.info(
599626
"Printing differential analysis between {} and {}".format(
@@ -723,6 +750,8 @@ def from_rts_to_regression_table(
723750
running_platform=None,
724751
baseline_architecture=ARCH_X86,
725752
comparison_architecture=ARCH_X86,
753+
first_n_baseline=-1,
754+
first_n_comparison=-1,
726755
):
727756
print_all = print_regressions_only is False and print_improvements_only is False
728757
table = []
@@ -835,6 +864,7 @@ def from_rts_to_regression_table(
835864
largest_variance,
836865
last_n_baseline,
837866
verbose,
867+
first_n_baseline,
838868
)
839869
for ts_name_comparison in comparison_timeseries:
840870
datapoints_inner = rts.ts().revrange(
@@ -854,6 +884,7 @@ def from_rts_to_regression_table(
854884
largest_variance,
855885
last_n_comparison,
856886
verbose,
887+
first_n_comparison,
857888
)
858889

859890
waterline = regressions_percent_lower_limit
@@ -1051,13 +1082,25 @@ def get_v_pct_change_and_largest_var(
10511082
largest_variance,
10521083
last_n=-1,
10531084
verbose=False,
1085+
first_n=-1,
10541086
):
10551087
comparison_nsamples = len(comparison_datapoints)
10561088
if comparison_nsamples > 0:
10571089
_, comparison_v = comparison_datapoints[0]
1058-
for tuple in comparison_datapoints:
1059-
if last_n < 0 or (last_n > 0 and len(comparison_values) < last_n):
1060-
comparison_values.append(tuple[1])
1090+
1091+
# Apply first_n and last_n boundaries
1092+
start_idx = 0 if first_n < 0 else max(0, min(first_n, comparison_nsamples))
1093+
end_idx = (
1094+
comparison_nsamples
1095+
if last_n < 0
1096+
else max(0, min(last_n, comparison_nsamples))
1097+
)
1098+
1099+
selected_data = comparison_datapoints[start_idx:end_idx]
1100+
1101+
for tuple in selected_data:
1102+
comparison_values.append(tuple[1])
1103+
10611104
comparison_df = pd.DataFrame(comparison_values)
10621105
comparison_median = float(comparison_df.median())
10631106
comparison_v = comparison_median

redisbench_admin/run/metrics.py

+28-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
import logging
77
import datetime as dt
8-
8+
import redis
99
from jsonpath_ng import parse
1010

1111

@@ -99,28 +99,33 @@ def collect_redis_metrics(
9999
for conn_n, conn in enumerate(redis_conns):
100100
conn_res = {}
101101
for section in sections:
102-
info = conn.info(section)
103-
conn_res[section] = info
104-
if section not in overall:
105-
overall[section] = {}
106-
for k, v in info.items():
107-
collect = True
108-
if section_filter is not None:
109-
if section in section_filter:
110-
if k not in section_filter[section]:
111-
collect = False
112-
if collect and type(v) is float or type(v) is int:
113-
if k not in overall[section]:
114-
overall[section][k] = 0
115-
overall[section][k] += v
116-
if collect and type(v) is dict:
117-
for inner_k, inner_v in v.items():
118-
if type(inner_v) is float or type(inner_v) is int:
119-
final_str_k = "{}_{}".format(k, inner_k)
120-
if multi_shard:
121-
final_str_k += "_shard_{}".format(conn_n + 1)
122-
if final_str_k not in overall[section]:
123-
overall[section][final_str_k] = inner_v
102+
try:
103+
info = conn.info(section)
104+
conn_res[section] = info
105+
if section not in overall:
106+
overall[section] = {}
107+
for k, v in info.items():
108+
collect = True
109+
if section_filter is not None:
110+
if section in section_filter:
111+
if k not in section_filter[section]:
112+
collect = False
113+
if collect and type(v) is float or type(v) is int:
114+
if k not in overall[section]:
115+
overall[section][k] = 0
116+
overall[section][k] += v
117+
if collect and type(v) is dict:
118+
for inner_k, inner_v in v.items():
119+
if type(inner_v) is float or type(inner_v) is int:
120+
final_str_k = "{}_{}".format(k, inner_k)
121+
if multi_shard:
122+
final_str_k += "_shard_{}".format(conn_n + 1)
123+
if final_str_k not in overall[section]:
124+
overall[section][final_str_k] = inner_v
125+
except redis.exceptions.ConnectionError as e:
126+
logging.warning(
127+
f"Unable to collect section {section} from redis. error: {e.__str__}"
128+
)
124129

125130
res.append(conn_res)
126131

redisbench_admin/run/run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def define_benchmark_plan(benchmark_definitions, default_specs):
8686
setup_contains_dbconfig = False
8787
if "dbconfig" in setup_settings:
8888
setup_contains_dbconfig = True
89-
logging.info(
89+
logging.debug(
9090
f"setup ({setup_name}): {setup_settings}. contains dbconfig {setup_contains_dbconfig}"
9191
)
9292

redisbench_admin/run_remote/run_remote.py

+25-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def run_remote_command_logic(args, project_name, project_version):
134134
keep_env_and_topo = args.keep_env_and_topo
135135
skip_remote_db_setup = args.skip_db_setup
136136
flushall_on_every_test_start = args.flushall_on_every_test_start
137-
redis_7 = args.redis_7
137+
redis_7 = True
138138
cluster_start_port = 20000
139139
redis_password = args.db_pass
140140
ignore_keyspace_errors = args.ignore_keyspace_errors
@@ -317,6 +317,7 @@ def run_remote_command_logic(args, project_name, project_version):
317317
spot_instance_error = False
318318
ts_key_spot_price = f"ts:{tf_triggering_env}:tests:spot_price"
319319
ts_key_full_price = f"ts:{tf_triggering_env}:tests:full_price"
320+
ts_key_architecture = f"ts:{tf_triggering_env}:tests:arch:{architecture}"
320321

321322
for benchmark_type, bench_by_dataset_map in benchmark_runs_plan.items():
322323
if return_code != 0 and args.fail_fast:
@@ -365,6 +366,8 @@ def run_remote_command_logic(args, project_name, project_version):
365366
)
366367
continue
367368
metadata_tags = get_metadata_tags(benchmark_config)
369+
if "arch" not in metadata_tags:
370+
metadata_tags["arch"] = architecture
368371
logging.info(
369372
"Including the extra metadata tags into this test generated time-series: {}".format(
370373
metadata_tags
@@ -462,6 +465,15 @@ def run_remote_command_logic(args, project_name, project_version):
462465
testcase_start_time_str,
463466
) = get_start_time_vars()
464467
if args.push_results_redistimeseries:
468+
logging.info(
469+
f"Updating overall arch tests counter {ts_key_architecture}"
470+
)
471+
rts.ts().add(
472+
ts_key_architecture,
473+
start_time_setup_ms,
474+
1,
475+
duplicate_policy="sum",
476+
)
465477
logging.info(
466478
f"Updating overall spot price tests counter {ts_key_spot_price}"
467479
)
@@ -843,7 +855,10 @@ def run_remote_command_logic(args, project_name, project_version):
843855
tf_github_org,
844856
tf_github_repo,
845857
tf_triggering_env,
846-
{"metric-type": "redis-metrics"},
858+
{
859+
"metric-type": "redis-metrics",
860+
"arch": architecture,
861+
},
847862
expire_ms,
848863
)
849864
if collect_commandstats:
@@ -866,7 +881,10 @@ def run_remote_command_logic(args, project_name, project_version):
866881
tf_github_org,
867882
tf_github_repo,
868883
tf_triggering_env,
869-
{"metric-type": "commandstats"},
884+
{
885+
"metric-type": "commandstats",
886+
"arch": architecture,
887+
},
870888
expire_ms,
871889
)
872890
(
@@ -888,7 +906,10 @@ def run_remote_command_logic(args, project_name, project_version):
888906
tf_github_org,
889907
tf_github_repo,
890908
tf_triggering_env,
891-
{"metric-type": "latencystats"},
909+
{
910+
"metric-type": "latencystats",
911+
"arch": architecture,
912+
},
892913
expire_ms,
893914
)
894915
except (

0 commit comments

Comments
 (0)