mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Merge pull request #36702 from fabxc/client-metrics
Automatic merge from submit-queue (batch tested with PRs 37701, 36702, 37145, 37424, 38261) Limit unbound label cardinality on request errors This converts all request errors to the string `<error>` instead of passing the full error string. Error strings can have arbitrary values and thus have a cardinality that is not suitable for a metric use case. Inspecting individual errors is a logging use case which can be handled separately by registering a client error handler. @kubernetes/sig-instrumentation
This commit is contained in:
		@@ -694,9 +694,10 @@ func updateURLMetrics(req *Request, resp *http.Response, err error) {
 | 
				
			|||||||
		url = req.baseURL.Host
 | 
							url = req.baseURL.Host
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// If we have an error (i.e. apiserver down) we report that as a metric label.
 | 
						// Errors can be arbitrary strings. Unbound label cardinality is not suitable for a metric
 | 
				
			||||||
 | 
						// system so we just report them as `<error>`.
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		metrics.RequestResult.Increment(err.Error(), req.verb, url)
 | 
							metrics.RequestResult.Increment("<error>", req.verb, url)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		//Metrics for failure codes
 | 
							//Metrics for failure codes
 | 
				
			||||||
		metrics.RequestResult.Increment(strconv.Itoa(resp.StatusCode), req.verb, url)
 | 
							metrics.RequestResult.Increment(strconv.Itoa(resp.StatusCode), req.verb, url)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user