You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When ActionDispatch::ShowExceptions captures an error, it renders the appropriate error page and then sets the correct exit status. To do this, it reuses the rack env (wrapped in a Request), and resets the path_info to /#{status} and runs that request with an exceptions_app. This may[1] result in the controller and action being overriden, since the exceptions_app will parse the path info and route to a different controller/action. This results in the wrong labels being added to the prometheus metrics.
[1] At least, when an exception app is configured with config.exceptions_app = routes.
We have worked around this locally by re-parsing the path when setting the labels:
defdefault_labels(env,result)labels=superiflabels[:controller] == "errors"params=beginRails.application.routes.recognize_path(env["REQUEST_PATH"])rescueActionController::RoutingErrornil# Si no podemos parsear no reemplazamos nomasendifparamslabels[:controller]=params[:controller]labels[:action]=params[:action]endendlabelsend
I don't know how to cleanly fix this. This only works for us because we know the "errors" controller is only used for error routing.
The text was updated successfully, but these errors were encountered:
When
ActionDispatch::ShowExceptions
captures an error, it renders the appropriate error page and then sets the correct exit status. To do this, it reuses the rack env (wrapped in a Request), and resets thepath_info
to/#{status}
and runs that request with anexceptions_app
. This may[1] result in the controller and action being overriden, since theexceptions_app
will parse the path info and route to a different controller/action. This results in the wrong labels being added to the prometheus metrics.[1] At least, when an exception app is configured with
config.exceptions_app = routes
.We have worked around this locally by re-parsing the path when setting the labels:
I don't know how to cleanly fix this. This only works for us because we know the "errors" controller is only used for error routing.
The text was updated successfully, but these errors were encountered: