-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query the original exception rather than Sentry::Event object
In the `before_send` callbacks, the first parameter is of type `Sentry::Event`, and the second parameter (`hint`) is a hash which contains the original exception at key `exception:`. Our datasync-ignorable-exception logic relies on querying the exception chain to see if any of the exceptions in the chain are of an ignorable exception type. This logic doesn't work when we view the `Sentry::Event` object (as we have been doing) - we must instead look at the `hint[:exception]` object. The consequence of this bug was that our logic to ignore certain exceptions that occur during the datasync, no longer worked, and we've therefore seen many thousands of Sentry errors since #196 was merged. However, it wasn't as simple as just checking the `hint` parameter. The `hint` parameter was missing, due to the way we had constructed our tests. Sentry automatically provides the `hint` parameter, but only if the event has been sent through all of the layers of Sentry's architecture, which took a bit of trial and error to get right. I took inspiration from [hub_spec.rb] and [sentry_spec.rb] from the Sentry gem repository. [hub_spec.rb]: https://github.com/getsentry/sentry-ruby/blob/e4b6d66612d9ce601596c23a5dd0d035c559d980/sentry-ruby/spec/sentry/hub_spec.rb [sentry_spec.rb]: https://github.com/getsentry/sentry-ruby/blob/ace176cfceaefc91e29364a1c4180a67337e8ab0/sentry-ruby/spec/sentry_spec.rb This has also exposed how our GovukStatsd incrementing was not working, as it would log all errors as `error_types.sentry_event` rather than their original exception types. This is fixed too.
- Loading branch information
1 parent
6d4571b
commit a664c0c
Showing
2 changed files
with
49 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters