Skip to content

Improve before_send and before_send_transaction's return value handling#2504

Merged
st0012 merged 4 commits intomasterfrom
improve-callback-value-handling
Jan 6, 2025
Merged

Improve before_send and before_send_transaction's return value handling#2504
st0012 merged 4 commits intomasterfrom
improve-callback-value-handling

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@st0012 st0012 commented Dec 29, 2024

The 1st commit fixes a testing setup issue and the 2nd commit adds additional checks to the before_send and before_send_transaction's callback values. I explained the changes with more details in the commit messages.

- It's usually better to require files explicitly when the number of files
  is manageable. Given that we only need 2 at the moment, I don't think
  it's worth using Dir.glob.
- Also, using Dir.glob causes it to load the Rakefile, which is for isolated
  testing and it actually initializes the SDK with the wrong configuration in
  other tests.
…n-events

Currently, if the callbacks return non-event and non-nil values, they'd
cause exceptions during serialization, which are rescued and ignored, without
explicit logging.

This commit adds additional checks to the return values so the users
get warnings and also avoids the unnecessary exceptions.
@st0012 st0012 force-pushed the improve-callback-value-handling branch from 56fbe47 to bf68695 Compare December 30, 2024 10:10
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.18%. Comparing base (ad535cc) to head (2f8bd4e).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2504      +/-   ##
==========================================
- Coverage   98.20%   98.18%   -0.02%     
==========================================
  Files         128      128              
  Lines        4837     4847      +10     
==========================================
+ Hits         4750     4759       +9     
- Misses         87       88       +1     
Components Coverage Δ
sentry-ruby 98.57% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.07% <ø> (ø)
sentry-sidekiq 97.09% <ø> (-0.33%) ⬇️
sentry-resque 92.85% <ø> (ø)
sentry-delayed_job 95.65% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/client.rb 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Copy link
Copy Markdown
Collaborator

@solnic solnic left a comment

Choose a reason for hiding this comment

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

LGTM (except that one typo in a comment)

Co-authored-by: Peter Solnica <peter@solnica.online>
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