From c0ceede084e2744512259904785e1daf6b623555 Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Wed, 3 Nov 2021 20:07:31 +0000 Subject: [PATCH] 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. --- internal/cloudapi/v2/errors.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/cloudapi/v2/errors.go b/internal/cloudapi/v2/errors.go index 1740424e1..b0378fc4f 100644 --- a/internal/cloudapi/v2/errors.go +++ b/internal/cloudapi/v2/errors.go @@ -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() }