@@ -79,6 +79,10 @@ type podStartupLatencyMeasurement struct {
7979 podStartupEntries * measurementutil.ObjectTransitionTimes
8080 podMetadata * measurementutil.PodsMetadata
8181 threshold time.Duration
82+ // Threshold for pod startup latency by percentile. The default value is threshold.
83+ perc50Threshold time.Duration
84+ perc90Threshold time.Duration
85+ perc99Threshold time.Duration
8286}
8387
8488// Execute supports two actions:
@@ -101,6 +105,18 @@ func (p *podStartupLatencyMeasurement) Execute(config *measurement.Config) ([]me
101105 if err != nil {
102106 return nil , err
103107 }
108+ p .perc50Threshold , err = util .GetDurationOrDefault (config .Params , "perc50Threshold" , p .threshold )
109+ if err != nil {
110+ return nil , err
111+ }
112+ p .perc90Threshold , err = util .GetDurationOrDefault (config .Params , "perc90Threshold" , p .threshold )
113+ if err != nil {
114+ return nil , err
115+ }
116+ p .perc99Threshold , err = util .GetDurationOrDefault (config .Params , "perc99Threshold" , p .threshold )
117+ if err != nil {
118+ return nil , err
119+ }
104120 return nil , p .start (config .ClusterFramework .GetClientSets ().GetClient ())
105121 case "gather" :
106122 schedulerName , err := util .GetStringOrDefault (config .Params , "schedulerName" , defaultSchedulerName )
@@ -255,7 +271,7 @@ func (p *podStartupLatencyMeasurement) gather(c clientset.Interface, identifier
255271 transitions := podStartupTransitionsWithThreshold (p .threshold )
256272 podStartupLatency := p .podStartupEntries .CalculateTransitionsLatency (transitions , check .filter )
257273
258- if slosErr := podStartupLatency ["pod_startup" ].VerifyThreshold (p .threshold ); slosErr != nil {
274+ if slosErr := podStartupLatency ["pod_startup" ].VerifyThresholdByPercentile (p .perc50Threshold , p . perc90Threshold , p . perc99Threshold ); slosErr != nil {
259275 err = errors .NewMetricViolationError ("pod startup" , slosErr .Error ())
260276 klog .Errorf ("%s%s: %v" , check .namePrefix , p , err )
261277 }
0 commit comments