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

Improve before_send and before_send_transaction's return value handling #2504

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

st0012
Copy link
Collaborator

@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
Copy link

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
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)

sentry-ruby/lib/sentry/client.rb Outdated Show resolved Hide resolved
Co-authored-by: Peter Solnica <peter@solnica.online>
@st0012 st0012 merged commit 315310f into master Jan 6, 2025
147 of 148 checks passed
@st0012 st0012 deleted the improve-callback-value-handling branch January 6, 2025 16:55
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