mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
vmauth: fix vmauth_user_request_backend_errors_total
metric calc logic for use case when only one backend is available - if we get an error from the retry_status_codes list, but cannot execute retry, we increment vmauth_user_request_backend_errors_total as well (#5688)
This commit is contained in:
parent
bd7ebb41b2
commit
ef4bb36d99
1 changed files with 14 additions and 9 deletions
|
@ -261,7 +261,8 @@ func tryProcessingRequest(w http.ResponseWriter, r *http.Request, targetURL *url
|
||||||
logger.Warnf("remoteAddr: %s; requestURI: %s; retrying the request to %s because of response error: %s", remoteAddr, req.URL, targetURL, err)
|
logger.Warnf("remoteAddr: %s; requestURI: %s; retrying the request to %s because of response error: %s", remoteAddr, req.URL, targetURL, err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (rtbOK && rtb.canRetry()) && hasInt(retryStatusCodes, res.StatusCode) {
|
if hasInt(retryStatusCodes, res.StatusCode) {
|
||||||
|
if rtbOK && rtb.canRetry() {
|
||||||
// Retry requests at other backends if it matches retryStatusCodes.
|
// Retry requests at other backends if it matches retryStatusCodes.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4893
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4893
|
||||||
remoteAddr := httpserver.GetQuotedRemoteAddr(r)
|
remoteAddr := httpserver.GetQuotedRemoteAddr(r)
|
||||||
|
@ -271,6 +272,10 @@ func tryProcessingRequest(w http.ResponseWriter, r *http.Request, targetURL *url
|
||||||
remoteAddr, req.URL, targetURL, res.StatusCode, retryStatusCodes)
|
remoteAddr, req.URL, targetURL, res.StatusCode, retryStatusCodes)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
// if we get an error from the retry_status_codes list, but cannot execute retry,
|
||||||
|
// we consider such a request an error as well
|
||||||
|
ui.backendErrors.Inc()
|
||||||
|
}
|
||||||
removeHopHeaders(res.Header)
|
removeHopHeaders(res.Header)
|
||||||
copyHeader(w.Header(), res.Header)
|
copyHeader(w.Header(), res.Header)
|
||||||
updateHeadersByConfig(w.Header(), hc.ResponseHeaders)
|
updateHeadersByConfig(w.Header(), hc.ResponseHeaders)
|
||||||
|
|
Loading…
Reference in a new issue