cloudapi/v2: 5xx error metrics

Currently error metrics are being recorded for
errors with the exact error code of 500. This
commit enables recording metrics for all 5xx errors.
This commit is contained in:
Gianluca Zuccarelli 2021-11-03 20:07:31 +00:00 committed by Ondřej Budai
parent 708d985194
commit c0ceede084

View file

@ -251,7 +251,8 @@ func (s *Server) HTTPErrorHandler(echoError error, c echo.Context) {
return
}
if he.Code == http.StatusInternalServerError {
internalError := he.Code >= http.StatusInternalServerError && he.Code <= http.StatusNetworkAuthenticationRequired
if internalError {
if strings.HasSuffix(c.Path(), "/compose") {
prometheus.ComposeFailures.Inc()
}