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

Avoid duplicated sampling on Transaction events #1601

Merged
merged 6 commits into from Nov 4, 2021

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Oct 31, 2021

As @sl0thentr0py pointed out on discord, having sample_allowed? inside sending_allowed? causes double sampling on transaction events and should be avoided. So this PR fixes the issue and removes an unnecessary sending check from the Transport class.

@st0012 st0012 added this to the 4.8.0 milestone Oct 31, 2021
@st0012 st0012 self-assigned this Oct 31, 2021
@st0012 st0012 added this to In progress in 4.x via automation Oct 31, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2021

Codecov Report

Merging #1601 (915a105) into master (ffc59a3) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1601      +/-   ##
==========================================
- Coverage   98.47%   98.44%   -0.03%     
==========================================
  Files         130      130              
  Lines        7223     7223              
==========================================
- Hits         7113     7111       -2     
- Misses        110      112       +2     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/transport.rb 98.18% <ø> (-0.16%) ⬇️
sentry-ruby/spec/sentry/transport_spec.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/client.rb 97.46% <100.00%> (+0.03%) ⬆️
sentry-ruby/lib/sentry/configuration.rb 98.36% <100.00%> (-1.10%) ⬇️
...ntry-ruby/spec/sentry/client/event_sending_spec.rb 99.57% <100.00%> (+0.03%) ⬆️
sentry-ruby/spec/sentry/configuration_spec.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffc59a3...915a105. Read the comment docs.

Transport should only care about sending the event object to the right
destination with right format. It doesn't need to check if it's allowed
to send an event, which should already be done by
`Client#capture_event`.
@st0012 st0012 force-pushed the fix-event-sending-restriction branch from 0154afb to c623b0e Compare October 31, 2021 10:06
@st0012 st0012 force-pushed the fix-event-sending-restriction branch from c623b0e to 915a105 Compare October 31, 2021 10:08
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

thx for the quick fix @st0012!
Looks good to my newbie eyes, just one minor optimization suggestion but can also ignore

sentry-ruby/lib/sentry/client.rb Outdated Show resolved Hide resolved
Co-authored-by: Neel Shah <neelshah.sa@gmail.com>
@st0012 st0012 merged commit 1bf154e into master Nov 4, 2021
@st0012 st0012 deleted the fix-event-sending-restriction branch November 4, 2021 18:07
4.x automation moved this from In progress to Done Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4.x
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants