@@ -168,7 +168,7 @@ func calculateDiffPercentage(current, previous float64) float64 {
168168
169169// CompareDirectWithThresholds evaluates the current and previous reports against specified thresholds.
170170// It checks for significant differences in metrics and returns any discrepancies found, aiding in performance analysis.
171- func CompareDirectWithThresholds (medianThreshold , p95Threshold , maxThreshold , errorRateThreshold float64 , currentReport , previousReport * StandardReport ) (bool , error ) {
171+ func CompareDirectWithThresholds (medianThreshold , p95Threshold , p99Threshold , maxThreshold , errorRateThreshold float64 , currentReport , previousReport * StandardReport ) (bool , error ) {
172172 if currentReport == nil || previousReport == nil {
173173 return true , errors .New ("one or both reports are nil" )
174174 }
@@ -178,11 +178,12 @@ func CompareDirectWithThresholds(medianThreshold, p95Threshold, maxThreshold, er
178178 Str ("Previous report" , previousReport .CommitOrTag ).
179179 Float64 ("Median threshold" , medianThreshold ).
180180 Float64 ("P95 threshold" , p95Threshold ).
181+ Float64 ("P99 threshold" , p99Threshold ).
181182 Float64 ("Max threshold" , maxThreshold ).
182183 Float64 ("Error rate threshold" , errorRateThreshold ).
183184 Msg ("Comparing Direct metrics with thresholds" )
184185
185- if thresholdsErr := validateThresholds (medianThreshold , p95Threshold , maxThreshold , errorRateThreshold ); thresholdsErr != nil {
186+ if thresholdsErr := validateThresholds (medianThreshold , p95Threshold , p99Threshold , maxThreshold , errorRateThreshold ); thresholdsErr != nil {
186187 return true , thresholdsErr
187188 }
188189
@@ -234,6 +235,10 @@ func CompareDirectWithThresholds(medianThreshold, p95Threshold, maxThreshold, er
234235 errors [genCfg .GenName ] = append (errors [genCfg .GenName ], err )
235236 }
236237
238+ if err := compareValues (string (Percentile99Latency ), genCfg .GenName , p99Threshold ); err != nil {
239+ errors [genCfg .GenName ] = append (errors [genCfg .GenName ], err )
240+ }
241+
237242 if err := compareValues (string (MaxLatency ), genCfg .GenName , maxThreshold ); err != nil {
238243 errors [genCfg .GenName ] = append (errors [genCfg .GenName ], err )
239244 }
@@ -264,7 +269,7 @@ func concatenateGeneratorErrors(errors map[string][]error) error {
264269 return goerrors .Join (errs ... )
265270}
266271
267- func validateThresholds (medianThreshold , p95Threshold , maxThreshold , errorRateThreshold float64 ) error {
272+ func validateThresholds (medianThreshold , p95Threshold , p99Threshold , maxThreshold , errorRateThreshold float64 ) error {
268273 var errs []error
269274
270275 var validateThreshold = func (name string , threshold float64 ) error {
@@ -282,6 +287,10 @@ func validateThresholds(medianThreshold, p95Threshold, maxThreshold, errorRateTh
282287 errs = append (errs , err )
283288 }
284289
290+ if err := validateThreshold ("p99" , p99Threshold ); err != nil {
291+ errs = append (errs , err )
292+ }
293+
285294 if err := validateThreshold ("max" , maxThreshold ); err != nil {
286295 errs = append (errs , err )
287296 }
0 commit comments