Fix sentry-rails' backtrace cleaner issues#2475
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2475 +/- ##
==========================================
- Coverage 98.17% 98.17% -0.01%
==========================================
Files 128 128
Lines 4829 4827 -2
==========================================
- Hits 4741 4739 -2
Misses 88 88
|
|
I'm fine with this change (after I test that grouping doesn't break this way either). But we still need at least the |
|
ok I tested grouping so this is fine to merge. so the only problem now that I'd ideally like to fix (if possible in a simpler way that #2474) is that this block sentry-ruby/sentry-rails/lib/sentry/rails/backtrace_cleaner.rb Lines 20 to 22 in 50716c0 does not preserve the That logic is either way repeated here sentry-ruby/sentry-ruby/lib/sentry/interfaces/stacktrace.rb Lines 50 to 59 in 50716c0 so are you ok with just removing that filter then? |
|
@sl0thentr0py ok I included that part of the fix too, and updated the PR description accordingly. |
In Rails 7.2, Rails's backtrace cleaner, which sentry-rails' backtrace cleaner inherits from, starts shortening gem's paths in backtraces. This will prevent sentry-ruby's `Sentry::Backtrace` from handling them correctly, which will result in issues like #2472. This commit avoids the issue by clearing the default filters that Sentry's backtrace cleaner inherits.
This filter removes the project root part from the stacktrace, which prevents sentry-ruby from retaining the correct absolute path of it.

Clear Rails' default backtrace filters from Sentry's backtrace cleaner
In Rails 7.2, Rails's backtrace cleaner, which sentry-rails' backtrace cleaner inherits from, starts shortening gem's paths in backtraces. This will prevent sentry-ruby's
Sentry::Backtracefrom handling them correctly, which will result in issues like #2472.This commit avoids the issue by clearing the default filters that Sentry's backtrace cleaner inherits.
Remove premature path-removal filter
This filter removes the project root part from the stacktrace, which prevents
sentry-ruby from retaining the correct absolute path of it.
Generally speaking, if stacktrace is messed up between Rails versions, but not Ruby versions, then it's usually caused by
Sentry::Rails::BacktraceCleanerand/or thebacktrace_cleanup_callbacksentry-rubyregisters (less likely). But if the backtrace is messed up between Ruby versions, it'd be onsentry-ruby's backtrace handling instead.Closes #2472