Skip to content

Limit test result score max value

Nailia Iskhakova requested to merge 607-overall-results-score into main

Update score calculation for the test to limit the upper value.

With the old calculation there could have been cases when score was larger than 100 - #607 (comment 2024177296):

...
 {"name"=>"git_pull",
  "rps_threshold"=>"1.60",
  "ttfb_p90_threshold"=>"400",
  "success_rate_threshold"=>"99",
  "ttfb_avg"=>"55.72",
  "ttfb_p90"=>"102.88",
  "ttfb_p95"=>"123.60",
  "rps_result"=>"6.95",
  "success_rate"=>"100.00",
  "rps_target"=>"2",
  "result"=>true,
  "score"=>347.5,
  "redo"=>false,
  "issues"=>nil,
  "flags"=>nil},

After the update:

=> {"name"=>"git_pull",
 "rps_target"=>"2",
 "rps_threshold"=>"1.60",
 "ttfb_p90_threshold"=>"400",
 "success_rate_threshold"=>"99",
 "data_received"=>#<MatchData ": 9.7 MB  159 kB/s" 1:"9.7 MB" 2:"159 kB/s">,
 "ttfb_avg"=>"55.72",
 "ttfb_p90"=>"102.88",
 "ttfb_p95"=>"123.60",
 "rps_result"=>"6.95",
 "success_rate"=>"100.00"}
[12] pry(main)> results["score"] = [results["rps_result"], results["rps_target"], results["success_rate"]].none?(&:nil?) ? [((results["rps_result"].to_f / results["rps_target"].to_f) * results["success_rate"].to_f).round(2), 100.0].min : 0.0
=> 100.0

Closes Review Overall Results Score calculation (#607 - closed)

Merge request reports

Loading