worker/v1: rearrange middlewares
The duration middleware should come after the tenant channel middleware, otherwise the tenant in the context will be empty. The status middleware can come beforehand because it queries the request context right before sending a response.
This commit is contained in:
parent
f303e7c233
commit
6040c10e10
1 changed files with 1 additions and 1 deletions
|
|
@ -102,11 +102,11 @@ func (s *Server) Handler() http.Handler {
|
|||
|
||||
mws := []echo.MiddlewareFunc{
|
||||
prometheus.StatusMiddleware(prometheus.WorkerSubsystem),
|
||||
prometheus.HTTPDurationMiddleware(prometheus.WorkerSubsystem),
|
||||
}
|
||||
if s.config.JWTEnabled {
|
||||
mws = append(mws, auth.TenantChannelMiddleware(s.config.TenantProviderFields, api.HTTPError(api.ErrorTenantNotFound)))
|
||||
}
|
||||
mws = append(mws, prometheus.HTTPDurationMiddleware(prometheus.WorkerSubsystem))
|
||||
api.RegisterHandlers(e.Group(api.BasePath, mws...), &handler)
|
||||
|
||||
return e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue