pluralize error metric name

Change-Id: I12eb94f41ded20ed5a16332ada13a7b34f75de18
This commit is contained in:
Han Kang 2019-10-08 15:49:12 -07:00
parent 4c6e724787
commit 5e652fe126

View File

@ -189,10 +189,10 @@ var (
[]string{"requestKind"}, []string{"requestKind"},
) )
requestErrorTotal = compbasemetrics.NewCounterVec( requestErrorsTotal = compbasemetrics.NewCounterVec(
&compbasemetrics.CounterOpts{ &compbasemetrics.CounterOpts{
Name: "apiserver_request_error_total", Name: "apiserver_request_errors_total",
Help: "Number of requests which have resulted in an apiserver response error", Help: "Number of requests which have resulted in an apiserver response error.",
StabilityLevel: compbasemetrics.ALPHA, StabilityLevel: compbasemetrics.ALPHA,
}, },
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component", "code"}, []string{"verb", "group", "version", "resource", "subresource", "scope", "component", "code"},
@ -213,7 +213,7 @@ var (
WatchEvents, WatchEvents,
WatchEventsSizes, WatchEventsSizes,
currentInflightRequests, currentInflightRequests,
requestErrorTotal, requestErrorsTotal,
} }
) )
@ -261,9 +261,9 @@ func RecordRequestError(req *http.Request, requestInfo *request.RequestInfo, com
// However, we need to tweak it e.g. to differentiate GET from LIST. // However, we need to tweak it e.g. to differentiate GET from LIST.
verb := canonicalVerb(strings.ToUpper(req.Method), scope) verb := canonicalVerb(strings.ToUpper(req.Method), scope)
if requestInfo.IsResourceRequest { if requestInfo.IsResourceRequest {
requestErrorTotal.WithLabelValues(cleanVerb(verb, req), requestInfo.APIGroup, requestInfo.APIVersion, requestInfo.Resource, requestInfo.Subresource, scope, component, codeToString(code)).Inc() requestErrorsTotal.WithLabelValues(cleanVerb(verb, req), requestInfo.APIGroup, requestInfo.APIVersion, requestInfo.Resource, requestInfo.Subresource, scope, component, codeToString(code)).Inc()
} else { } else {
requestErrorTotal.WithLabelValues(cleanVerb(verb, req), "", "", "", requestInfo.Path, scope, component, codeToString(code)).Inc() requestErrorsTotal.WithLabelValues(cleanVerb(verb, req), "", "", "", requestInfo.Path, scope, component, codeToString(code)).Inc()
} }
} }