@@ -251,6 +251,14 @@ def compare_command_logic(args, project_name, project_version):
251
251
testname_regex = args .testname_regex
252
252
auto_approve = args .auto_approve
253
253
running_platform = args .running_platform
254
+
255
+ # Handle separate baseline and comparison platform/environment arguments
256
+ # Fall back to general arguments if specific ones are not provided
257
+ running_platform_baseline = args .running_platform_baseline or args .running_platform
258
+ running_platform_comparison = args .running_platform_comparison or args .running_platform
259
+ triggering_env_baseline = args .triggering_env_baseline or args .triggering_env
260
+ triggering_env_comparison = args .triggering_env_comparison or args .triggering_env
261
+
254
262
baseline_target_version = args .baseline_target_version
255
263
comparison_target_version = args .comparison_target_version
256
264
baseline_target_branch = args .baseline_target_branch
@@ -262,10 +270,31 @@ def compare_command_logic(args, project_name, project_version):
262
270
baseline_hash = args .baseline_hash
263
271
comparison_hash = args .comparison_hash
264
272
265
- if running_platform is not None :
273
+ # Log platform and environment information
274
+ if running_platform_baseline == running_platform_comparison :
275
+ if running_platform_baseline is not None :
276
+ logging .info (
277
+ "Using platform named: {} for both baseline and comparison.\n \n " .format (
278
+ running_platform_baseline
279
+ )
280
+ )
281
+ else :
282
+ logging .info (
283
+ "Using platform named: {} for baseline and {} for comparison.\n \n " .format (
284
+ running_platform_baseline , running_platform_comparison
285
+ )
286
+ )
287
+
288
+ if triggering_env_baseline == triggering_env_comparison :
289
+ logging .info (
290
+ "Using triggering environment: {} for both baseline and comparison." .format (
291
+ triggering_env_baseline
292
+ )
293
+ )
294
+ else :
266
295
logging .info (
267
- "Using platform named : {} to do the comparison.\n \n " .format (
268
- running_platform
296
+ "Using triggering environment : {} for baseline and {} for comparison." .format (
297
+ triggering_env_baseline , triggering_env_comparison
269
298
)
270
299
)
271
300
@@ -328,7 +357,8 @@ def compare_command_logic(args, project_name, project_version):
328
357
rts ,
329
358
tf_github_org ,
330
359
tf_github_repo ,
331
- tf_triggering_env ,
360
+ triggering_env_baseline ,
361
+ triggering_env_comparison ,
332
362
metric_name ,
333
363
comparison_branch ,
334
364
baseline_branch ,
@@ -352,7 +382,8 @@ def compare_command_logic(args, project_name, project_version):
352
382
to_date ,
353
383
to_ts_ms ,
354
384
use_metric_context_path ,
355
- running_platform ,
385
+ running_platform_baseline ,
386
+ running_platform_comparison ,
356
387
baseline_target_version ,
357
388
comparison_target_version ,
358
389
baseline_hash ,
@@ -383,11 +414,13 @@ def compare_command_logic(args, project_name, project_version):
383
414
pr_link ,
384
415
regression_comment ,
385
416
rts ,
386
- running_platform ,
417
+ running_platform_baseline ,
418
+ running_platform_comparison ,
387
419
table_output ,
388
420
tf_github_org ,
389
421
tf_github_repo ,
390
- tf_triggering_env ,
422
+ triggering_env_baseline ,
423
+ triggering_env_comparison ,
391
424
total_comparison_points ,
392
425
total_improvements ,
393
426
total_regressions ,
@@ -423,11 +456,13 @@ def prepare_regression_comment(
423
456
pr_link ,
424
457
regression_comment ,
425
458
rts ,
426
- running_platform ,
459
+ running_platform_baseline ,
460
+ running_platform_comparison ,
427
461
table_output ,
428
462
tf_github_org ,
429
463
tf_github_repo ,
430
- tf_triggering_env ,
464
+ triggering_env_baseline ,
465
+ triggering_env_comparison ,
431
466
total_comparison_points ,
432
467
total_improvements ,
433
468
total_regressions ,
@@ -441,9 +476,25 @@ def prepare_regression_comment(
441
476
if total_comparison_points > 0 :
442
477
comment_body = "### Automated performance analysis summary\n \n "
443
478
comment_body += "This comment was automatically generated given there is performance data available.\n \n "
444
- if running_platform is not None :
445
- comment_body += "Using platform named: {} to do the comparison.\n \n " .format (
446
- running_platform
479
+ # Add platform information to comment
480
+ if running_platform_baseline == running_platform_comparison :
481
+ if running_platform_baseline is not None :
482
+ comment_body += "Using platform named: {} for both baseline and comparison.\n \n " .format (
483
+ running_platform_baseline
484
+ )
485
+ else :
486
+ comment_body += "Using platform named: {} for baseline and {} for comparison.\n \n " .format (
487
+ running_platform_baseline , running_platform_comparison
488
+ )
489
+
490
+ # Add triggering environment information to comment
491
+ if triggering_env_baseline == triggering_env_comparison :
492
+ comment_body += "Using triggering environment: {} for both baseline and comparison.\n \n " .format (
493
+ triggering_env_baseline
494
+ )
495
+ else :
496
+ comment_body += "Using triggering environment: {} for baseline and {} for comparison.\n \n " .format (
497
+ triggering_env_baseline , triggering_env_comparison
447
498
)
448
499
comparison_summary = "In summary:\n "
449
500
if total_stable > 0 :
@@ -507,7 +558,7 @@ def prepare_regression_comment(
507
558
508
559
if is_actionable_pr :
509
560
zset_project_pull_request = get_project_compare_zsets (
510
- tf_triggering_env ,
561
+ triggering_env_baseline ,
511
562
tf_github_org ,
512
563
tf_github_repo ,
513
564
)
@@ -516,16 +567,22 @@ def prepare_regression_comment(
516
567
zset_project_pull_request , comparison_branch
517
568
)
518
569
)
519
- _ , start_time_ms , _ = get_start_time_vars ()
520
- res = rts .zadd (
521
- zset_project_pull_request ,
522
- {comparison_branch : start_time_ms },
523
- )
524
- logging .info (
525
- "Result of Populating the pull request performance ZSETs: {} with branch {}: {}" .format (
526
- zset_project_pull_request , comparison_branch , res
570
+ # Only add to Redis sorted set if comparison_branch is not None
571
+ if comparison_branch is not None :
572
+ _ , start_time_ms , _ = get_start_time_vars ()
573
+ res = rts .zadd (
574
+ zset_project_pull_request ,
575
+ {comparison_branch : start_time_ms },
576
+ )
577
+ logging .info (
578
+ "Result of Populating the pull request performance ZSETs: {} with branch {}: {}" .format (
579
+ zset_project_pull_request , comparison_branch , res
580
+ )
581
+ )
582
+ else :
583
+ logging .warning (
584
+ "Skipping Redis ZADD operation because comparison_branch is None"
527
585
)
528
- )
529
586
530
587
if contains_regression_comment :
531
588
update_comment_if_needed (
@@ -587,7 +644,8 @@ def compute_regression_table(
587
644
rts ,
588
645
tf_github_org ,
589
646
tf_github_repo ,
590
- tf_triggering_env ,
647
+ tf_triggering_env_baseline ,
648
+ tf_triggering_env_comparison ,
591
649
metric_name ,
592
650
comparison_branch ,
593
651
baseline_branch = "unstable" ,
@@ -611,7 +669,8 @@ def compute_regression_table(
611
669
to_date = None ,
612
670
to_ts_ms = None ,
613
671
use_metric_context_path = None ,
614
- running_platform = None ,
672
+ running_platform_baseline = None ,
673
+ running_platform_comparison = None ,
615
674
baseline_target_version = None ,
616
675
comparison_target_version = None ,
617
676
comparison_hash = None ,
@@ -672,7 +731,7 @@ def compute_regression_table(
672
731
_ ,
673
732
_ ,
674
733
_ ,
675
- ) = get_overall_dashboard_keynames (tf_github_org , tf_github_repo , tf_triggering_env )
734
+ ) = get_overall_dashboard_keynames (tf_github_org , tf_github_repo , tf_triggering_env_baseline )
676
735
test_names = []
677
736
used_key = testcases_setname
678
737
test_filter = "test_name"
@@ -728,9 +787,11 @@ def compute_regression_table(
728
787
simplify_table ,
729
788
test_filter ,
730
789
test_names ,
731
- tf_triggering_env ,
790
+ tf_triggering_env_baseline ,
791
+ tf_triggering_env_comparison ,
732
792
verbose ,
733
- running_platform ,
793
+ running_platform_baseline ,
794
+ running_platform_comparison ,
734
795
baseline_github_repo ,
735
796
comparison_github_repo ,
736
797
baseline_github_org ,
@@ -1047,9 +1108,11 @@ def from_rts_to_regression_table(
1047
1108
simplify_table ,
1048
1109
test_filter ,
1049
1110
test_names ,
1050
- tf_triggering_env ,
1111
+ tf_triggering_env_baseline ,
1112
+ tf_triggering_env_comparison ,
1051
1113
verbose ,
1052
- running_platform = None ,
1114
+ running_platform_baseline = None ,
1115
+ running_platform_comparison = None ,
1053
1116
baseline_github_repo = "redis" ,
1054
1117
comparison_github_repo = "redis" ,
1055
1118
baseline_github_org = "redis" ,
@@ -1109,28 +1172,28 @@ def from_rts_to_regression_table(
1109
1172
"{}={}" .format (test_filter , test_name ),
1110
1173
"deployment_name={}" .format (baseline_deployment_name ),
1111
1174
"github_repo={}" .format (baseline_github_repo ),
1112
- "triggering_env={}" .format (tf_triggering_env ),
1175
+ "triggering_env={}" .format (tf_triggering_env_baseline ),
1113
1176
]
1114
1177
if baseline_github_org != "" :
1115
1178
filters_baseline .append (f"github_org={ baseline_github_org } " )
1116
- if running_platform is not None :
1117
- filters_baseline .append ("running_platform={}" .format (running_platform ))
1179
+ if running_platform_baseline is not None :
1180
+ filters_baseline .append ("running_platform={}" .format (running_platform_baseline ))
1118
1181
filters_comparison = [
1119
1182
"{}={}" .format (by_str_comparison , comparison_str ),
1120
1183
"metric={}" .format (metric_name ),
1121
1184
"{}={}" .format (test_filter , test_name ),
1122
1185
"deployment_name={}" .format (comparison_deployment_name ),
1123
1186
"github_repo={}" .format (comparison_github_repo ),
1124
- "triggering_env={}" .format (tf_triggering_env ),
1187
+ "triggering_env={}" .format (tf_triggering_env_comparison ),
1125
1188
]
1126
1189
if comparison_github_org != "" :
1127
1190
filters_comparison .append (f"github_org={ comparison_github_org } " )
1128
1191
if "hash" not in by_str_baseline :
1129
1192
filters_baseline .append ("hash==" )
1130
1193
if "hash" not in by_str_comparison :
1131
1194
filters_comparison .append ("hash==" )
1132
- if running_platform is not None :
1133
- filters_comparison .append ("running_platform={}" .format (running_platform ))
1195
+ if running_platform_comparison is not None :
1196
+ filters_comparison .append ("running_platform={}" .format (running_platform_comparison ))
1134
1197
baseline_timeseries = rts .ts ().queryindex (filters_baseline )
1135
1198
comparison_timeseries = rts .ts ().queryindex (filters_comparison )
1136
1199
@@ -1302,30 +1365,61 @@ def from_rts_to_regression_table(
1302
1365
if baseline_v != "N/A" or comparison_v != "N/A" :
1303
1366
detected_regression = False
1304
1367
detected_improvement = False
1305
- if percentage_change < 0.0 :
1306
- if - waterline >= percentage_change :
1307
- detected_regression = True
1308
- total_regressions = total_regressions + 1
1309
- note = note + f" { regression_str } "
1310
- detected_regressions .append (test_name )
1311
- elif percentage_change < - noise_waterline :
1312
- if simplify_table is False :
1313
- note = note + f" potential { regression_str } "
1314
- else :
1315
- if simplify_table is False :
1316
- note = note + " No Change"
1317
-
1318
- if percentage_change > 0.0 :
1319
- if percentage_change > waterline :
1320
- detected_improvement = True
1321
- total_improvements = total_improvements + 1
1322
- note = note + f" { improvement_str } "
1323
- elif percentage_change > noise_waterline :
1324
- if simplify_table is False :
1325
- note = note + f" potential { improvement_str } "
1326
- else :
1327
- if simplify_table is False :
1328
- note = note + " No Change"
1368
+
1369
+ # For higher-better metrics: negative change = regression, positive change = improvement
1370
+ # For lower-better metrics: positive change = regression, negative change = improvement
1371
+ if metric_mode == "higher-better" :
1372
+ # Higher is better: negative change is bad (regression), positive change is good (improvement)
1373
+ if percentage_change < 0.0 :
1374
+ if - waterline >= percentage_change :
1375
+ detected_regression = True
1376
+ total_regressions = total_regressions + 1
1377
+ note = note + f" { regression_str } "
1378
+ detected_regressions .append (test_name )
1379
+ elif percentage_change < - noise_waterline :
1380
+ if simplify_table is False :
1381
+ note = note + f" potential { regression_str } "
1382
+ else :
1383
+ if simplify_table is False :
1384
+ note = note + " No Change"
1385
+
1386
+ if percentage_change > 0.0 :
1387
+ if percentage_change > waterline :
1388
+ detected_improvement = True
1389
+ total_improvements = total_improvements + 1
1390
+ note = note + f" { improvement_str } "
1391
+ elif percentage_change > noise_waterline :
1392
+ if simplify_table is False :
1393
+ note = note + f" potential { improvement_str } "
1394
+ else :
1395
+ if simplify_table is False :
1396
+ note = note + " No Change"
1397
+ else :
1398
+ # Lower is better: positive change is bad (regression), negative change is good (improvement)
1399
+ if percentage_change > 0.0 :
1400
+ if percentage_change >= waterline :
1401
+ detected_regression = True
1402
+ total_regressions = total_regressions + 1
1403
+ note = note + f" { regression_str } "
1404
+ detected_regressions .append (test_name )
1405
+ elif percentage_change > noise_waterline :
1406
+ if simplify_table is False :
1407
+ note = note + f" potential { regression_str } "
1408
+ else :
1409
+ if simplify_table is False :
1410
+ note = note + " No Change"
1411
+
1412
+ if percentage_change < 0.0 :
1413
+ if - percentage_change > waterline :
1414
+ detected_improvement = True
1415
+ total_improvements = total_improvements + 1
1416
+ note = note + f" { improvement_str } "
1417
+ elif - percentage_change > noise_waterline :
1418
+ if simplify_table is False :
1419
+ note = note + f" potential { improvement_str } "
1420
+ else :
1421
+ if simplify_table is False :
1422
+ note = note + " No Change"
1329
1423
1330
1424
for test_group in tested_groups :
1331
1425
if test_group not in group_change :
0 commit comments