-
Couldn't load subscription status.
- Fork 99
Description
Hello.
I have got an proposal on prometheus middleware.
In the project I am working on, we use internally defined errors, which are resolved to status codes at echo HTTPErrorHandler.
Prometheus middleware, as an Echo middleware, runs before HTTPErrorHandler, so it cannot reference the final status code resolved in the Handler or the internally defined errors mentioned earlier.
Here is my proposal:
Add an errorToStatusCodeResolver option to the MiddlewareConfig that resolves error to status code.
Default behavior should remain as it is, referencing echo.HTTPError.
https://github.com/labstack/echo-contrib/blob/master/prometheus/prometheus.go#L426-L434
If users define an additional resolver, it should use that resolver.
If there is an open PR, I will create it.
Thank you.