From 8b5458ae830b9c63095d5e3ab7fece3f60cbfe4b Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Mon, 21 Nov 2022 17:05:26 +0000 Subject: [PATCH] internal/cloudapi: register status code middleware Register the custom middleware function to the cloudapi server. This function is responsible for recording all the status codes of all the server's endpoints. --- internal/cloudapi/v2/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/cloudapi/v2/server.go b/internal/cloudapi/v2/server.go index cb1725328..dfcc52c70 100644 --- a/internal/cloudapi/v2/server.go +++ b/internal/cloudapi/v2/server.go @@ -87,7 +87,9 @@ func (s *Server) Handler(path string) http.Handler { handler := apiHandlers{ server: s, } - RegisterHandlers(e.Group(path, prometheus.MetricsMiddleware, s.ValidateRequest), &handler) + + statusMW := prometheus.StatusMiddleware(prometheus.ComposerSubsystem) + RegisterHandlers(e.Group(path, prometheus.MetricsMiddleware, s.ValidateRequest, statusMW), &handler) return e }