Conversation
Codecov Report
@@ Coverage Diff @@
## master #1011 +/- ##
==========================================
+ Coverage 97.89% 97.94% +0.04%
==========================================
Files 49 50 +1
Lines 2238 2283 +45
==========================================
+ Hits 2191 2236 +45
Misses 47 47
Continue to review full report at Codecov.
|
st0012
force-pushed
the
fix-#957
branch
3 times, most recently
from
September 3, 2020 16:13
e416e65 to
ea0e814
Compare
davidstosik
approved these changes
Sep 4, 2020
davidstosik
left a comment
There was a problem hiding this comment.
👏 Thanks a lot, this is looking great, and provides a nice modularity!
a proc/lambda that takes an array of stack traces it'll be used to cleanup backtrace of the exception for example: ```ruby Raven.configuration.backtrace_cleanup_callback = lambda do |backtrace| Rails.backtrace_cleaner.clean(backtrace) end ```
ChrisBAshton
added a commit
to alphagov/govuk_app_config
that referenced
this pull request
Oct 19, 2020
In order to improve Sentry's grouping of errors, we want to make use of the `backtrace_cleanup_callback` introduced in 3.1.0: getsentry/sentry-ruby#1011 `backtrace_cleanup_callback` automatically uses a [customised version of Rails::BacktraceCleaner](https://github.com/getsentry/sentry-ruby/pull/1011/files#diff-c01d5cbc846720e47a4185cb501a55225247ec698aa169b0a2773ca9b65ae35dR4-R29) if we don't specify our own. It means that for stack traces like: `app/views/welcome/view_error.html.erb in _app_views_welcome_view_error_html_erb__2807287320172182514_65600 at line 1` ...these lines get normalised to: `app/views/welcome/view_error.html.erb at line 1` So if the same `ActionView::Template::Error` error happens twice, it will now be grouped instead of erroneously treated as separate errors. This behaviour differs from the [native `Rails::BacktraceCleaner`](https://github.com/rails/rails/blob/b66235d432d0505857ff667e0a1ddecfb5640a56/railties/lib/rails/backtrace_cleaner.rb), which has 'silencers' that remove any "framework trace" from your stacktrace, leaving only the "application trace" behind. This would actually be beneficial for grouping, as Sentry is very sensitive to stack traces that differ only slightly, which can happen when a dependency is updated or a Ruby version is upgraded. We could specify sentry-raven to use the Rails backtrace cleaner like so: ```ruby config.backtrace_cleanup_callback = lambda do |backtrace| Rails.backtrace_cleaner.clean(backtrace) end ``` ...however, this is not _only_ used for the comparison, but would alter the stacktrace itself, meaning we lose key diagnostic information. This isn't a price worth paying for the sake of 'neatness' in our Sentry groupings. Trello: https://trello.com/c/NZNjFHWO/2162-5-improve-sentrys-grouping-of-exceptions
This was referenced Oct 19, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds 2 new features:
New config option:
backtrace_cleanup_callbackIt takes a lambda/proc object (default is
nil) and will be called with exception's backtrace. Here's an example usage:Automatically clean Rails app's backtrace
With the Rails integration, it'll automatically use a customized
Raven::Rails::BacktraceCleanerto clean up exception's backtrace. This can be disabled by:Raven::Rails::BacktraceCleaner
This cleaner is pretty much like Rails 6's backtrace cleaner but without silencers. The main reason to add this cleaner is to remove template methods from the trace, e.g.
will become
This can help Sentry group issues more accurately. See #957 for more information about this.
Closes #957