Skip to content

Ensuring architecture is present on metadata across all timeseries #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "redisbench-admin"
version = "0.11.32"
version = "0.11.35"
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
readme = "README.md"
Expand Down
12 changes: 12 additions & 0 deletions redisbench_admin/compare/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@
default=1,
help="Use the last N samples for each time-serie. by default will use last value only",
)
parser.add_argument(

Check warning on line 95 in redisbench_admin/compare/args.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/args.py#L95

Added line #L95 was not covered by tests
"--first_n_baseline",
type=int,
default=-1,
help="Use the last N samples for each time-serie. by default will use last 7 available values",
)
parser.add_argument(

Check warning on line 101 in redisbench_admin/compare/args.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/args.py#L101

Added line #L101 was not covered by tests
"--first_n_comparison",
type=int,
default=-1,
help="Use the last N samples for each time-serie. by default will use last value only",
)
parser.add_argument(
"--from-date",
type=lambda s: datetime.datetime.strptime(s, "%Y-%m-%d"),
Expand Down
57 changes: 50 additions & 7 deletions redisbench_admin/compare/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,31 @@
last_n_baseline = args.last_n_baseline
if last_n_comparison < 0:
last_n_comparison = args.last_n_comparison
logging.info("Using last {} samples for baseline analysis".format(last_n_baseline))
logging.info(
"Using last {} samples for comparison analysis".format(last_n_comparison)
)
first_n_baseline = args.first_n_baseline
first_n_comparison = args.first_n_comparison

Check warning on line 139 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L138-L139

Added lines #L138 - L139 were not covered by tests
# Log the interval of values considered
if first_n_baseline >= 0:
logging.info(

Check warning on line 142 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L141-L142

Added lines #L141 - L142 were not covered by tests
"Using samples in the range [{}:{}] for baseline analysis".format(
first_n_baseline, last_n_baseline
)
)
else:
logging.info(

Check warning on line 148 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L148

Added line #L148 was not covered by tests
"Using last {} samples for baseline analysis".format(last_n_baseline)
)

if first_n_comparison >= 0:
logging.info(

Check warning on line 153 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L152-L153

Added lines #L152 - L153 were not covered by tests
"Using samples in the range [{}:{}] for comparison analysis".format(
first_n_comparison, last_n_comparison
)
)
else:
logging.info(

Check warning on line 159 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L159

Added line #L159 was not covered by tests
"Using last {} samples for comparison analysis".format(last_n_comparison)
)

verbose = args.verbose
regressions_percent_lower_limit = args.regressions_percent_lower_limit
metric_name = args.metric_name
Expand Down Expand Up @@ -280,6 +301,8 @@
running_platform,
baseline_architecture,
comparison_architecture,
first_n_baseline,
first_n_comparison,
)
comment_body = ""
if total_comparison_points > 0:
Expand Down Expand Up @@ -506,6 +529,8 @@
running_platform=None,
baseline_architecture=ARCH_X86,
comparison_architecture=ARCH_X86,
first_n_baseline=-1,
first_n_comparison=-1,
):
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=31)
Expand Down Expand Up @@ -594,6 +619,8 @@
running_platform,
baseline_architecture,
comparison_architecture,
first_n_baseline,
first_n_comparison,
)
logging.info(
"Printing differential analysis between {} and {}".format(
Expand Down Expand Up @@ -723,6 +750,8 @@
running_platform=None,
baseline_architecture=ARCH_X86,
comparison_architecture=ARCH_X86,
first_n_baseline=-1,
first_n_comparison=-1,
):
print_all = print_regressions_only is False and print_improvements_only is False
table = []
Expand Down Expand Up @@ -835,6 +864,7 @@
largest_variance,
last_n_baseline,
verbose,
first_n_baseline,
)
for ts_name_comparison in comparison_timeseries:
datapoints_inner = rts.ts().revrange(
Expand All @@ -854,6 +884,7 @@
largest_variance,
last_n_comparison,
verbose,
first_n_comparison,
)

waterline = regressions_percent_lower_limit
Expand Down Expand Up @@ -1051,13 +1082,25 @@
largest_variance,
last_n=-1,
verbose=False,
first_n=-1,
):
comparison_nsamples = len(comparison_datapoints)
if comparison_nsamples > 0:
_, comparison_v = comparison_datapoints[0]
for tuple in comparison_datapoints:
if last_n < 0 or (last_n > 0 and len(comparison_values) < last_n):
comparison_values.append(tuple[1])

# Apply first_n and last_n boundaries
start_idx = 0 if first_n < 0 else max(0, min(first_n, comparison_nsamples))
end_idx = (

Check warning on line 1093 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L1092-L1093

Added lines #L1092 - L1093 were not covered by tests
comparison_nsamples
if last_n < 0
else max(0, min(last_n, comparison_nsamples))
)

selected_data = comparison_datapoints[start_idx:end_idx]

Check warning on line 1099 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L1099

Added line #L1099 was not covered by tests

for tuple in selected_data:
comparison_values.append(tuple[1])

Check warning on line 1102 in redisbench_admin/compare/compare.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/compare/compare.py#L1101-L1102

Added lines #L1101 - L1102 were not covered by tests

comparison_df = pd.DataFrame(comparison_values)
comparison_median = float(comparison_df.median())
comparison_v = comparison_median
Expand Down
51 changes: 28 additions & 23 deletions redisbench_admin/run/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
import logging
import datetime as dt

import redis
from jsonpath_ng import parse


Expand Down Expand Up @@ -99,28 +99,33 @@
for conn_n, conn in enumerate(redis_conns):
conn_res = {}
for section in sections:
info = conn.info(section)
conn_res[section] = info
if section not in overall:
overall[section] = {}
for k, v in info.items():
collect = True
if section_filter is not None:
if section in section_filter:
if k not in section_filter[section]:
collect = False
if collect and type(v) is float or type(v) is int:
if k not in overall[section]:
overall[section][k] = 0
overall[section][k] += v
if collect and type(v) is dict:
for inner_k, inner_v in v.items():
if type(inner_v) is float or type(inner_v) is int:
final_str_k = "{}_{}".format(k, inner_k)
if multi_shard:
final_str_k += "_shard_{}".format(conn_n + 1)
if final_str_k not in overall[section]:
overall[section][final_str_k] = inner_v
try:
info = conn.info(section)
conn_res[section] = info
if section not in overall:
overall[section] = {}
for k, v in info.items():
collect = True
if section_filter is not None:
if section in section_filter:
if k not in section_filter[section]:
collect = False
if collect and type(v) is float or type(v) is int:
if k not in overall[section]:
overall[section][k] = 0
overall[section][k] += v
if collect and type(v) is dict:
for inner_k, inner_v in v.items():
if type(inner_v) is float or type(inner_v) is int:
final_str_k = "{}_{}".format(k, inner_k)
if multi_shard:
final_str_k += "_shard_{}".format(conn_n + 1)
if final_str_k not in overall[section]:
overall[section][final_str_k] = inner_v
except redis.exceptions.ConnectionError as e:
logging.warning(

Check warning on line 126 in redisbench_admin/run/metrics.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run/metrics.py#L118-L126

Added lines #L118 - L126 were not covered by tests
f"Unable to collect section {section} from redis. error: {e.__str__}"
)

res.append(conn_res)

Expand Down
2 changes: 1 addition & 1 deletion redisbench_admin/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def define_benchmark_plan(benchmark_definitions, default_specs):
setup_contains_dbconfig = False
if "dbconfig" in setup_settings:
setup_contains_dbconfig = True
logging.info(
logging.debug(
f"setup ({setup_name}): {setup_settings}. contains dbconfig {setup_contains_dbconfig}"
)

Expand Down
29 changes: 25 additions & 4 deletions redisbench_admin/run_remote/run_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
keep_env_and_topo = args.keep_env_and_topo
skip_remote_db_setup = args.skip_db_setup
flushall_on_every_test_start = args.flushall_on_every_test_start
redis_7 = args.redis_7
redis_7 = True

Check warning on line 137 in redisbench_admin/run_remote/run_remote.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run_remote/run_remote.py#L137

Added line #L137 was not covered by tests
cluster_start_port = 20000
redis_password = args.db_pass
ignore_keyspace_errors = args.ignore_keyspace_errors
Expand Down Expand Up @@ -317,6 +317,7 @@
spot_instance_error = False
ts_key_spot_price = f"ts:{tf_triggering_env}:tests:spot_price"
ts_key_full_price = f"ts:{tf_triggering_env}:tests:full_price"
ts_key_architecture = f"ts:{tf_triggering_env}:tests:arch:{architecture}"

Check warning on line 320 in redisbench_admin/run_remote/run_remote.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run_remote/run_remote.py#L320

Added line #L320 was not covered by tests

for benchmark_type, bench_by_dataset_map in benchmark_runs_plan.items():
if return_code != 0 and args.fail_fast:
Expand Down Expand Up @@ -365,6 +366,8 @@
)
continue
metadata_tags = get_metadata_tags(benchmark_config)
if "arch" not in metadata_tags:
metadata_tags["arch"] = architecture

Check warning on line 370 in redisbench_admin/run_remote/run_remote.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run_remote/run_remote.py#L369-L370

Added lines #L369 - L370 were not covered by tests
logging.info(
"Including the extra metadata tags into this test generated time-series: {}".format(
metadata_tags
Expand Down Expand Up @@ -462,6 +465,15 @@
testcase_start_time_str,
) = get_start_time_vars()
if args.push_results_redistimeseries:
logging.info(

Check warning on line 468 in redisbench_admin/run_remote/run_remote.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run_remote/run_remote.py#L468

Added line #L468 was not covered by tests
f"Updating overall arch tests counter {ts_key_architecture}"
)
rts.ts().add(

Check warning on line 471 in redisbench_admin/run_remote/run_remote.py

View check run for this annotation

Codecov / codecov/patch

redisbench_admin/run_remote/run_remote.py#L471

Added line #L471 was not covered by tests
ts_key_architecture,
start_time_setup_ms,
1,
duplicate_policy="sum",
)
logging.info(
f"Updating overall spot price tests counter {ts_key_spot_price}"
)
Expand Down Expand Up @@ -843,7 +855,10 @@
tf_github_org,
tf_github_repo,
tf_triggering_env,
{"metric-type": "redis-metrics"},
{
"metric-type": "redis-metrics",
"arch": architecture,
},
expire_ms,
)
if collect_commandstats:
Expand All @@ -866,7 +881,10 @@
tf_github_org,
tf_github_repo,
tf_triggering_env,
{"metric-type": "commandstats"},
{
"metric-type": "commandstats",
"arch": architecture,
},
expire_ms,
)
(
Expand All @@ -888,7 +906,10 @@
tf_github_org,
tf_github_repo,
tf_triggering_env,
{"metric-type": "latencystats"},
{
"metric-type": "latencystats",
"arch": architecture,
},
expire_ms,
)
except (
Expand Down