New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not report rendered errors except 500 #51107
Do not report rendered errors except 500 #51107
Conversation
@@ -15,7 +15,9 @@ def call(env) | |||
begin | |||
response = @app.call(env) | |||
if rendered_error = env["action_dispatch.exception"] | |||
@executor.error_reporter.report(rendered_error, handled: false, source: "application.action_dispatch") | |||
unless ExceptionWrapper.rescue_response?(rendered_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this here, why we just don't add it to env["action_dispatch.exception"]
if it isn't rescuable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that. But we can add the exception to a different key in the env only if we want it to be reported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, my biggest concern was the use of ExceptionWrapper.rescue_response?
in the executor. Feels like executor shouldn't ideally know about the wrapper.
We can't do that
Just to make sure we have the same understanding. Is that because exceptions_app
(ActionDispatch::PublicExceptions
by default) expects action_dispatch.exception
header to be present?
What if we still pass the header to exceptions_app
but drop it afterwards?
I guess using a different key makes more sense, I just wasn't sure if it's okay to add more headers. Let me try that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I added a "action_dispatch.report_exception"
boolean flag to indicate whether the exception should be reported or not. I felt like it's excessive to have two headers pointing to the same exception in case if it needs to be reported.
15003e6
to
5d5cc03
Compare
cc @fractaledmind as you initially reported the issue and I was wondering if this tweak still aligns with your vision of the problem |
In `4067c9565a5da78a72e375a2d959000147f02c34` `ActionDispatch::Executor` started to report all errors, even the ones that were "handled" by the application. This leads to errors like `ActionController::RoutingError` polluting error trackers while not being actionable since they do not represent an exceptional situation. This commit changes the behavior to only report errors that are not considered "handled" based on the `ActionDispatch::ExceptionWrapper.rescue_responses` list.
5d5cc03
to
a8d1d92
Compare
…-errors-differently Do not report rendered errors except 500
I believe this does still solve the original problem. I like your thought for a future next step to set I will read the details of the rescuable check to ensure that it isn't too strict, but I expect it isn't and all important errors would be reported with this change. |
…-errors-differently Do not report rendered errors except 500
So I think the current patch is fine, no need for a followup. |
TLDR Context
#51050 change results in error tracking service being polluted with
ActionController::RoutingError
which are not actionable and we don't want them thereContext
In 4067c95
ActionDispatch::Executor
started to report all errors, even the ones that were "handled" by the application. This leads to errors likeActionController::RoutingError
polluting error trackers while not being actionable since they do not represent an exceptional situation.This commit changes the behavior to only report errors that are not considered "handled" based on the
ActionDispatch::ExceptionWrapper.rescue_responses
list.Alternative solution
What I have considered and what might actually be a better solution for the long-term is to report "handled" exceptions as
handled: true
. This way subscribers can decide how they want to proceed reporting something that has already been handled. Example: While I strongly believe thatActionController::RoutingError
should not be presented on the error tracker in the same way as something likeraise "boom"
, I can see that some applications may want to soft-report them in a way that doesn't trigger any alerts and doesn't require any attention. For example It's totally expected to haveActionController::RoutingError
exceptions but if the number ofActionController::RoutingError
spikes it may indicate that either some link that used to be accessible became unaccessible or a wrong link was posted/rendered somewhere which makes such event actionable and worth reporting.But regardless,
ActionController::RoutingError
(and similar) exceptions should not suddenly be reported as part of a patch version upgrade. It should be a major change with perhaps a configuration option to allow applications to adapt and make a decision on how to proceed.I'm open for the discussion and eager to learn what are yours expectations on this behavior!