2424from redisbench_admin .utils .remote import get_overall_dashboard_keynames
2525
2626
27+ def get_project_compare_zsets (triggering_env , org , repo ):
28+ return "ci.benchmarks.redislabs/{}/{}/{}:compare:pull_requests:zset" .format (
29+ triggering_env , org , repo
30+ )
31+
32+
2733def compare_command_logic (args , project_name , project_version ):
2834 logging .info (
2935 "Using: {project_name} {project_version}" .format (
@@ -157,6 +163,7 @@ def compare_command_logic(args, project_name, project_version):
157163 pull_request = args .pull_request
158164 testname_regex = args .testname_regex
159165 auto_approve = args .auto_approve
166+ running_platform = args .running_platform
160167 grafana_base_dashboard = args .grafana_base_dashboard
161168 # using an access token
162169 is_actionable_pr = False
@@ -166,6 +173,12 @@ def compare_command_logic(args, project_name, project_version):
166173 # slack related
167174 webhook_notifications_active = False
168175 webhook_client_slack = None
176+ if running_platform is not None :
177+ logging .info (
178+ "Using platform named: {} to do the comparison.\n \n " .format (
179+ running_platform
180+ )
181+ )
169182 if WH_TOKEN is not None :
170183 webhook_notifications_active = True
171184 webhook_url = "https://hooks.slack.com/services/{}" .format (WH_TOKEN )
@@ -258,11 +271,16 @@ def compare_command_logic(args, project_name, project_version):
258271 to_date ,
259272 to_ts_ms ,
260273 use_metric_context_path ,
274+ running_platform ,
261275 )
262276 comment_body = ""
263277 if total_comparison_points > 0 :
264278 comment_body = "### Automated performance analysis summary\n \n "
265279 comment_body += "This comment was automatically generated given there is performance data available.\n \n "
280+ if running_platform is not None :
281+ comment_body += "Using platform named: {} to do the comparison.\n \n " .format (
282+ running_platform
283+ )
266284 comparison_summary = "In summary:\n "
267285 if total_stable > 0 :
268286 comparison_summary += (
@@ -307,6 +325,26 @@ def compare_command_logic(args, project_name, project_version):
307325 print (comment_body )
308326
309327 if is_actionable_pr :
328+ zset_project_pull_request = get_project_compare_zsets (
329+ tf_triggering_env ,
330+ tf_github_org ,
331+ tf_github_repo ,
332+ )
333+ logging .info (
334+ "Populating the pull request performance ZSETs: {} with branch {}" .format (
335+ zset_project_pull_request , comparison_branch
336+ )
337+ )
338+ _ , start_time_ms , _ = get_start_time_vars ()
339+ res = rts .zadd (
340+ zset_project_pull_request ,
341+ {comparison_branch : start_time_ms },
342+ )
343+ logging .info (
344+ "Result of Populating the pull request performance ZSETs: {} with branch {}: {}" .format (
345+ zset_project_pull_request , comparison_branch , res
346+ )
347+ )
310348 user_input = "n"
311349 html_url = "n/a"
312350 regression_count = len (detected_regressions )
@@ -451,6 +489,7 @@ def compute_regression_table(
451489 to_date = None ,
452490 to_ts_ms = None ,
453491 use_metric_context_path = None ,
492+ running_platform = None ,
454493):
455494 START_TIME_NOW_UTC , _ , _ = get_start_time_vars ()
456495 START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime .timedelta (days = 31 )
@@ -534,6 +573,7 @@ def compute_regression_table(
534573 test_names ,
535574 tf_triggering_env ,
536575 verbose ,
576+ running_platform ,
537577 )
538578 logging .info (
539579 "Printing differential analysis between {} and {}" .format (
@@ -640,6 +680,7 @@ def from_rts_to_regression_table(
640680 test_names ,
641681 tf_triggering_env ,
642682 verbose ,
683+ running_platform = None ,
643684):
644685 print_all = print_regressions_only is False and print_improvements_only is False
645686 table = []
@@ -659,13 +700,17 @@ def from_rts_to_regression_table(
659700 "deployment_name={}" .format (baseline_deployment_name ),
660701 "triggering_env={}" .format (tf_triggering_env ),
661702 ]
703+ if running_platform is not None :
704+ filters_baseline .append ("running_platform={}" .format (running_platform ))
662705 filters_comparison = [
663706 "{}={}" .format (by_str , comparison_str ),
664707 "metric={}" .format (metric_name ),
665708 "{}={}" .format (test_filter , test_name ),
666709 "deployment_name={}" .format (comparison_deployment_name ),
667710 "triggering_env={}" .format (tf_triggering_env ),
668711 ]
712+ if running_platform is not None :
713+ filters_comparison .append ("running_platform={}" .format (running_platform ))
669714 baseline_timeseries = rts .ts ().queryindex (filters_baseline )
670715 comparison_timeseries = rts .ts ().queryindex (filters_comparison )
671716
0 commit comments