Skip to content

Commit acac3f3

Browse files
[fix] Only collecting commandstats/server stats on master branch or version. (#276)
* [fix] Only collecting commandstats/server stats on master branch or version.
1 parent fd394f6 commit acac3f3

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
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 = "redisbench-admin"
3-
version = "0.6.12"
3+
version = "0.6.13"
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/compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def compare_command_logic(args, project_name, project_version):
211211

212212
except redis.exceptions.ResponseError:
213213
pass
214-
214+
unstable = False
215215
if baseline_v != "N/A" and comparison_v != "N/A":
216216
stamp_b = ""
217217
unstable = False

redisbench_admin/run_remote/run_remote.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,18 @@ def run_remote_command_logic(args, project_name, project_version):
530530
)
531531
)
532532

533-
if args.push_results_redistimeseries:
533+
if args.push_results_redistimeseries and (
534+
artifact_version is not None
535+
or tf_github_branch == "master"
536+
):
534537
(
535538
end_time_ms,
536539
_,
537540
overall_end_time_metrics,
538541
) = collect_redis_metrics(
539-
redis_conns, ["cpu", "memory"]
542+
redis_conns, ["memory"]
540543
)
544+
expire_ms = 7 * 24 * 60 * 60 * 1000
541545
export_redis_metrics(
542546
artifact_version,
543547
end_time_ms,
@@ -550,6 +554,8 @@ def run_remote_command_logic(args, project_name, project_version):
550554
tf_github_org,
551555
tf_github_repo,
552556
tf_triggering_env,
557+
{"metric-type": "redis-metrics"},
558+
expire_ms,
553559
)
554560
(
555561
end_time_ms,
@@ -571,6 +577,7 @@ def run_remote_command_logic(args, project_name, project_version):
571577
tf_github_repo,
572578
tf_triggering_env,
573579
{"metric-type": "commandstats"},
580+
expire_ms,
574581
)
575582

576583
if setup_details["env"] is None:
@@ -791,6 +798,7 @@ def export_redis_metrics(
791798
tf_github_repo,
792799
tf_triggering_env,
793800
metadata_dict=None,
801+
expire_ms=0,
794802
):
795803
datapoint_errors = 0
796804
datapoint_inserts = 0
@@ -858,7 +866,9 @@ def export_redis_metrics(
858866
),
859867
"data": {end_time_ms: metric_value},
860868
}
861-
i_errors, i_inserts = push_data_to_redistimeseries(rts, timeseries_dict)
869+
i_errors, i_inserts = push_data_to_redistimeseries(
870+
rts, timeseries_dict, expire_msecs
871+
)
862872
datapoint_errors = datapoint_errors + i_errors
863873
datapoint_inserts = datapoint_inserts + i_inserts
864874
return datapoint_errors, datapoint_inserts

redisbench_admin/utils/remote.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def fetch_remote_setup_from_config(
504504
return terraform_working_dir, setup_type, setup
505505

506506

507-
def push_data_to_redistimeseries(rts, time_series_dict: dict):
507+
def push_data_to_redistimeseries(rts, time_series_dict: dict, expire_msecs=0):
508508
datapoint_errors = 0
509509
datapoint_inserts = 0
510510
if rts is not None and time_series_dict is not None:
@@ -543,6 +543,8 @@ def push_data_to_redistimeseries(rts, time_series_dict: dict):
543543
)
544544
datapoint_errors += 1
545545
pass
546+
if expire_msecs > 0:
547+
rts.redis.pexpire(timeseries_name, expire_msecs)
546548
return datapoint_errors, datapoint_inserts
547549

548550

0 commit comments

Comments
 (0)