DR-2982: Send Sentry errors in GlobalExceptionHandler #1476
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Original Sentry integration is not working (Original PR: #1364). I was able to successfully register an error in sentry locally, but since merging the change, we have not seen any errors logged in our other environments.
So, what's going on?
My understanding of sentry is that we should be able to automagically capture errors that we're otherwise routing to stackdriver to also log in sentry via the logback definition. It seems that Sentry picks up some errors in my local environment, but not on my personal dev environment. Something about the deployed instance is not working. So, I'm not sure what's going wrong. I've spent a good amount of time investigating this and I think there is a better solution, so I'm instead pivoting to a different approach.
The Solution
Even if we got the logback configuration to work, it wouldn't really serve the desired purpose for Sentry. It would capture too many errors, creating a lot of noise and would overuse our allocated resources in Sentry (there is a limit to how many errors we can log in Sentry).
Another solution is to manually capture specific types of errors directly to sentry. We can do this the GlobalExceptionHandler.
Which exceptions should we capture?
We want Sentry to log unexpected exceptions that we should fix/handle differently. With this changes, this currently includes:
Reviewers: Please let me know if you think I should include more/less of these exceptions.
More notes can be found in this doc: https://docs.google.com/document/d/1E6UTXHbj4Qs9hwujIMHO0vGCLfdrGIsylJZCdLHvMJQ/edit