@@ -1619,7 +1619,10 @@ def validate_performance_baselines(self) -> list[str]:
16191619 cpu_tolerance = self .args .cpu_tolerance
16201620 mem_tolerance = self .args .mem_tolerance
16211621 runtime_tolerance = self .args .runtime_tolerance
1622-
1622+ baseline_offset = self .args .baseline_offset
1623+ baseline_name = {0 : "weekly" , 30 : "monthly" , 365 : "yearly" }.get (
1624+ baseline_offset , f"{ baseline_offset } d"
1625+ )
16231626 alerts = []
16241627 for scenario_name in self .scenario_names :
16251628 msg_prefix = f"Scenario { scenario_name } : "
@@ -1641,7 +1644,7 @@ def validate_performance_baselines(self) -> list[str]:
16411644 if averages .avg_time > baseline .avg_time * (100 + runtime_tolerance ) / 100 :
16421645 overshoot = round ((averages .avg_time / baseline .avg_time ) * 100 - 100 , 2 )
16431646 msg = (
1644- f"Execution time baseline exceeded by { overshoot } % "
1647+ f"Execution time baseline { baseline_name } exceeded by { overshoot } % "
16451648 f"(baseline: { round (baseline .avg_time , 2 )} ;"
16461649 f" actual: { round (averages .avg_time , 2 )} "
16471650 )
@@ -1650,15 +1653,15 @@ def validate_performance_baselines(self) -> list[str]:
16501653 if averages .avg_cpu > baseline .avg_cpu * (100 + cpu_tolerance ) / 100 :
16511654 overshoot = round ((averages .avg_cpu / baseline .avg_cpu ) * 100 - 100 , 2 )
16521655 msg = (
1653- f"CPU usage baseline exceeded by { overshoot } % "
1656+ f"CPU usage baseline { baseline_name } exceeded by { overshoot } % "
16541657 f"(baseline: { round (baseline .avg_cpu , 2 )} %;"
16551658 f" actual: { round (averages .avg_cpu , 2 )} %"
16561659 )
16571660 alerts .append (f"{ msg_prefix } { msg } { msg_suffix } " )
16581661 if averages .avg_mem > baseline .avg_mem * (100 + mem_tolerance ) / 100 :
16591662 overshoot = round ((averages .avg_mem / baseline .avg_mem ) * 100 - 100 , 2 )
16601663 msg = (
1661- f"Memory usage baseline exceeded by { overshoot } % "
1664+ f"Memory usage baseline { baseline_name } exceeded by { overshoot } % "
16621665 f"(baseline: { round (baseline .avg_mem , 2 )} %;"
16631666 f" actual: { round (averages .avg_mem , 2 )} %"
16641667 )
0 commit comments