Increase api latency threshold for cluster-scoped list calls
This commit is contained in:
		| @@ -52,8 +52,10 @@ const ( | |||||||
| 	apiCallLatencyThreshold time.Duration = 1 * time.Second | 	apiCallLatencyThreshold time.Duration = 1 * time.Second | ||||||
|  |  | ||||||
| 	// We use a higher threshold for list apicalls if the cluster is big (i.e having > 500 nodes) | 	// We use a higher threshold for list apicalls if the cluster is big (i.e having > 500 nodes) | ||||||
| 	// as list response sizes are bigger in general for big clusters. | 	// as list response sizes are bigger in general for big clusters. We also use a higher threshold | ||||||
|  | 	// for list calls at cluster scope (this includes non-namespaced and all-namespaced calls). | ||||||
| 	apiListCallLatencyThreshold      time.Duration = 5 * time.Second | 	apiListCallLatencyThreshold      time.Duration = 5 * time.Second | ||||||
|  | 	apiClusterScopeListCallThreshold time.Duration = 10 * time.Second | ||||||
| 	bigClusterNodeCountThreshold                   = 500 | 	bigClusterNodeCountThreshold                   = 500 | ||||||
|  |  | ||||||
| 	// Cluster Autoscaler metrics names | 	// Cluster Autoscaler metrics names | ||||||
| @@ -371,13 +373,19 @@ func HighLatencyRequests(c clientset.Interface, nodeCount int) (int, *APIRespons | |||||||
| 	for i := range metrics.APICalls { | 	for i := range metrics.APICalls { | ||||||
| 		latency := metrics.APICalls[i].Latency.Perc99 | 		latency := metrics.APICalls[i].Latency.Perc99 | ||||||
| 		isListCall := (metrics.APICalls[i].Verb == "LIST") | 		isListCall := (metrics.APICalls[i].Verb == "LIST") | ||||||
|  | 		isClusterScopedCall := (metrics.APICalls[i].Scope == "cluster") | ||||||
| 		isBad := false | 		isBad := false | ||||||
| 		if latency > apiCallLatencyThreshold { | 		latencyThreshold := apiCallLatencyThreshold | ||||||
| 			if !isListCall || !isBigCluster || (latency > apiListCallLatencyThreshold) { | 		if isListCall && isBigCluster { | ||||||
|  | 			latencyThreshold = apiListCallLatencyThreshold | ||||||
|  | 			if isClusterScopedCall { | ||||||
|  | 				latencyThreshold = apiClusterScopeListCallThreshold | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		if latency > latencyThreshold { | ||||||
| 			isBad = true | 			isBad = true | ||||||
| 			badMetrics++ | 			badMetrics++ | ||||||
| 		} | 		} | ||||||
| 		} |  | ||||||
| 		if top > 0 || isBad { | 		if top > 0 || isBad { | ||||||
| 			top-- | 			top-- | ||||||
| 			prefix := "" | 			prefix := "" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Shyam Jeedigunta
					Shyam Jeedigunta