Skip to content

Conversation

@sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Nov 25, 2024

At some point, rails added a default gem filter to their BacktraceCleaner which messed up our linecache/context lines parsing logic since we get paths like

activesupport (7.1.2) lib/active_support/callbacks.rb

instead of raw paths.

This PR cleans up handling this case by making a clear distinction between abs_path and filename as was intended in the original relay protocol and we were never populating these properly.

Fixes #2472

@sl0thentr0py sl0thentr0py changed the title Don't let backtrace_cleanup_callback affect abs_path Don't let backtrace_cleanup_callback affect abs_path and separate filename handling Nov 25, 2024
@sl0thentr0py
Copy link
Member Author

NOTE: since this affects the payload and grouping, I explicitly tested that the old and new payloads end up in the same issue group and it seems fine since we are only changing the underlying abs_path and simply making it more accurate.

@sl0thentr0py sl0thentr0py force-pushed the neel/fix-rails-bt-linecache branch from acca59c to 7027718 Compare November 25, 2024 16:42
@codecov
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.17%. Comparing base (a9b3687) to head (2309e5b).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2474   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files         128      128           
  Lines        4825     4833    +8     
=======================================
+ Hits         4737     4745    +8     
  Misses         88       88           
Components Coverage Δ
sentry-ruby 98.57% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.08% <ø> (ø)
sentry-sidekiq 96.96% <ø> (ø)
sentry-resque 92.85% <ø> (ø)
sentry-delayed_job 95.65% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/backtrace.rb 97.10% <100.00%> (+0.38%) ⬆️
sentry-ruby/lib/sentry/interfaces/stacktrace.rb 95.91% <100.00%> (ø)

@sl0thentr0py sl0thentr0py force-pushed the neel/fix-rails-bt-linecache branch 4 times, most recently from e513e20 to d5ffd07 Compare November 26, 2024 12:41
_, file, number, _, method = ruby_match.to_a
file.sub!(/\.class$/, RB_EXTENSION)
_, abs_path, number, _, method = ruby_match.to_a
abs_path.sub!(/\.class$/, RB_EXTENSION)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original file is now the abs_path and the file is computed if necessary later properly

@sl0thentr0py sl0thentr0py force-pushed the neel/fix-rails-bt-linecache branch from d5ffd07 to 4a00256 Compare November 26, 2024 13:46
At some point, rails added a [default gem filter to their
`BacktraceCleaner`](https://github.com/rails/rails/blob/a8709e6ea26eca73a652af4fdd0a9f7db5352af4/activesupport/lib/active_support/backtrace_cleaner.rb#L118-L125)
which messed up our linecache/context lines parsing logic since we get
paths like
```
activesupport (7.1.2) lib/active_support/callbacks.rb
```
instead of raw paths.

This PR cleans up handling this case by making a clear distinction
between `abs_path` and `filename` as was intended in the original relay
protocol and we were never populating these properly.
@sl0thentr0py sl0thentr0py force-pushed the neel/fix-rails-bt-linecache branch from 4a00256 to 2309e5b Compare November 26, 2024 14:22
@sl0thentr0py
Copy link
Member Author

testing

all frames have context now

grafik grafik

grouping is the same

grafik

@st0012
Copy link
Contributor

st0012 commented Nov 26, 2024

Please hold off merging this, I think the cause may be at other places and thus require a different change.

@sl0thentr0py
Copy link
Member Author

closed in favor of #2475

@sl0thentr0py sl0thentr0py deleted the neel/fix-rails-bt-linecache branch December 4, 2024 14:02
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.

Fix Source Code Extraction to Stack Traces (regression via rails)

3 participants