From a247736f2ae10da4270c2cdf6b31058ee02078f7 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Sat, 12 Nov 2016 18:37:20 +0100 Subject: [PATCH] Limit unbound label cardinality on request errors This converts all request errors to the string `` 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. --- pkg/client/restclient/request.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/restclient/request.go b/pkg/client/restclient/request.go index 0f17d0badc..9f3bb70e4a 100644 --- a/pkg/client/restclient/request.go +++ b/pkg/client/restclient/request.go @@ -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 ``. if err != nil { - metrics.RequestResult.Increment(err.Error(), req.verb, url) + metrics.RequestResult.Increment("", req.verb, url) } else { //Metrics for failure codes metrics.RequestResult.Increment(strconv.Itoa(resp.StatusCode), req.verb, url)