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.
This commit is contained in:
Gianluca Zuccarelli 2022-11-21 17:05:26 +00:00 committed by Ondřej Budai
parent 8756ea717d
commit 8b5458ae83

View file

@ -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
}