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

Don't record breadcrumbs in disabled environments #1549

Merged
merged 2 commits into from
Aug 26, 2021

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Aug 26, 2021

The extra computation is unnecessary and can slow down users' applications in dev/test environments.

Unrelated Notes

I spotted this issue when using ruby/debug's trace call command to trace my application's code and see the repeated occurrence of Sentry related calls.

DEBUGGER (trace/call) #th:1 #depth:103>                                                                                                       block at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentr
y-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:29
DEBUGGER (trace/call) #th:1 #depth:104>                                                                                                        Kernel#is_a? at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/ge
ms/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:31
DEBUGGER (trace/call) #th:1 #depth:104<                                                                                                        Kernel#is_a? #=> "true" at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/ge
ms/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:31
DEBUGGER (trace/call) #th:1 #depth:104>                                                                                                        #<Class:Sentry::Rails::Breadcrumb::ActiveSupportLogger>#add at /Users/st00
12/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:10
DEBUGGER (trace/call) #th:1 #depth:105>                                                                                                         String#start_with? at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2
.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:12
DEBUGGER (trace/call) #th:1 #depth:105<                                                                                                         String#start_with? #=> "false" at /Users/st0012/.rbenv/versions/2.7.4/lib
/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:12
DEBUGGER (trace/call) #th:1 #depth:105>                                                                                                         Kernel#is_a? at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/g
ems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:14
DEBUGGER (trace/call) #th:1 #depth:105<                                                                                                         Kernel#is_a? #=> "true" at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/g
ems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:14
DEBUGGER (trace/call) #th:1 #depth:105>                                                                                                         Kernel#dup at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gem
s/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:106>                                                                                                          Kernel#initialize_dup at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/ge
ms/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:107>                                                                                                           Hash#initialize_copy at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/ge
ms/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:107<                                                                                                           Hash#initialize_copy #=> "{:sql=>\"SELECT `ticket_allocations`.* ... at
 /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:106<                                                                                                          Kernel#initialize_dup #=> "{:sql=>\"SELECT `ticket_allocations`.* ... at
 /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:105<                                                                                                         Kernel#dup #=> "{:sql=>\"SELECT `ticket_allocations`.* ... at /Users/st00
12/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/breadcrumb/active_support_logger.rb:16
DEBUGGER (trace/call) #th:1 #depth:105>                                                                                                         Sentry::Rails::InstrumentPayloadCleanupHelper#cleanup_data at /Users/st00
12/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/sentry-rails-4.6.5/lib/sentry/rails/instrument_payload_cleanup_helper.rb:6
DEBUGGER (trace/call) #th:1 #depth:106>                                                                                                          Array#each at /Users/st0012/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/ge
.... and hundreds more

The extra computation is unnecessary and can slow down users'
applications in dev/test environments.
@st0012 st0012 added this to the 4.7.0 milestone Aug 26, 2021
@st0012 st0012 self-assigned this Aug 26, 2021
@st0012 st0012 added this to In progress in 4.x via automation Aug 26, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2021

Codecov Report

Merging #1549 (f294fe9) into master (2cc4c21) will increase coverage by 0.37%.
The diff coverage is 100.00%.

❗ Current head f294fe9 differs from pull request most recent head 20ed2d9. Consider uploading reports for the commit 20ed2d9 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1549      +/-   ##
==========================================
+ Coverage   97.91%   98.28%   +0.37%     
==========================================
  Files         222      127      -95     
  Lines       10839     7009    -3830     
==========================================
- Hits        10613     6889    -3724     
+ Misses        226      120     -106     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/hub.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/hub_spec.rb 100.00% <100.00%> (ø)
sentry-raven/lib/raven/linecache.rb
sentry-raven/lib/raven/event.rb
...try-raven/lib/sentry-raven-without-integrations.rb
...ven/breadcrumbs/active_support_breadcrumbs_spec.rb
...ven/spec/raven/utils/exception_cause_chain_spec.rb
sentry-raven/lib/raven/interfaces/message.rb
sentry-raven/lib/raven/integrations/delayed_job.rb
...try-raven/lib/sentry_raven_without_integrations.rb
... and 87 more

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 2cc4c21...20ed2d9. Read the comment docs.

@st0012 st0012 merged commit 4712364 into master Aug 26, 2021
@st0012 st0012 deleted the dont-record-breadcrumb-in-disabled-envs branch August 26, 2021 04:47
4.x automation moved this from In progress to Done Aug 26, 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

2 participants