mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
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.
This commit is contained in:
parent
68a7c2c6b5
commit
a247736f2a
@ -693,9 +693,10 @@ func updateURLMetrics(req *Request, resp *http.Response, err error) {
|
||||
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 {
|
||||
metrics.RequestResult.Increment(err.Error(), req.verb, url)
|
||||
metrics.RequestResult.Increment("<error>", req.verb, url)
|
||||
} else {
|
||||
//Metrics for failure codes
|
||||
metrics.RequestResult.Increment(strconv.Itoa(resp.StatusCode), req.verb, url)
|
||||
|
Loading…
Reference in New Issue
Block a user