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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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 (bf68695).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2504      +/-   ##
==========================================
- Coverage   98.20%   98.18%   -0.02%     
==========================================
  Files         128      128              
  Lines        4837     4839       +2     
==========================================
+ Hits         4750     4751       +1     
- Misses         87       88       +1     
Components Coverage Δ
sentry-ruby 98.57% <100.00%> (+<0.01%) ⬆️
sentry-rails 96.91% <ø> (-0.16%) ⬇️
sentry-sidekiq 97.42% <ø> (ø)
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 1 file with indirect coverage changes

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.

1 participant