Skip to content
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

Bump 'sentry-raven' to 3.1.1 to improve grouping of errors #162

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

ChrisBAshton
Copy link
Contributor

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
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,
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:

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

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
@ChrisBAshton ChrisBAshton merged commit 6340c63 into master Oct 20, 2020
@ChrisBAshton ChrisBAshton deleted the fingerprinting branch October 20, 2020 07:17
ChrisBAshton added a commit that referenced this pull request Oct 20, 2020
Also adds a couple of missing links to the changelog.
Arises from #162.
@ChrisBAshton ChrisBAshton mentioned this pull request Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants