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

Remove verbose data from #inspect result #1602

Merged
merged 4 commits into from Nov 8, 2021
Merged

Remove verbose data from #inspect result #1602

merged 4 commits into from Nov 8, 2021

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Nov 4, 2021

This PR removes some lengthy data from Event, Configuration, and SingleExceptionInterface's #inspect method. (SingleExceptionInterface is usually included in Event's inspect result, so it's important to keep it simple too).

Removing those data will make inspecting those objects easier and help debug or report the SDK issues.

Example

event = Sentry.capture_message("foo")
event.inspect.length

Before

52024 (too long so skip pasting)

After

2905

#<Sentry::Event @event_id="9a85bad59bb64044a2e99679c3adc618", @timestamp="2021-11-05T18:37:15Z", @platform=:ruby, @sdk={"name"=>"sentry.ruby", "version"=>"4.7.3"}, 
@user={}, @extra={}, @contexts={:os=>{:name=>"Darwin", :version=>"Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101", :build=>"20.6.0", :kernel_version=>"Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101"}, :runtime=>{:name=>"ruby", :version=>"ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin20]"}}, @tags={}, @fingerprint=[], @server_name="Stans-MBPR-2.local", @environment="development", @release="fix-#1600\n", @message="foo", @level=:error, @threads=#<Sentry::ThreadsInterface:0x00007fb9245de0a0 @id=5340, @name=nil, @current=true, @crashed=false, @stacktrace=[
"bin/rails:9", "bootsnap (1.9.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31", "bootsnap (1.9.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22", "bootsnap (1.9.0) lib/bootsnap/load_path_cache/loaded_features_index.rb:92", 
"bootsnap (1.9.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23", "bootsnap (1.9.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23", 
"railties (6.1.4.1) lib/rails/commands.rb:18", "railties (6.1.4.1) lib/rails/command.rb:48", "railties (6.1.4.1) lib/rails/command/base.rb:69", 
"thor (1.1.0) lib/thor.rb:392", "thor (1.1.0) lib/thor/invocation.rb:127", "thor (1.1.0) lib/thor/command.rb:27", "railties (6.1.4.1) lib/rails/commands/console/console_command.rb:102", "railties (6.1.4.1) lib/rails/commands/console/console_command.rb:19", 
"railties (6.1.4.1) lib/rails/commands/console/console_command.rb:70", "irb (1.3.7) lib/irb.rb:409", "irb (1.3.7) lib/irb.rb:480", "irb (1.3.7) lib/irb.rb:480", "irb (1.3.7) lib/irb.rb:481", "irb (1.3.7) lib/irb.rb:547", "irb (1.3.7) lib/irb/ruby-lex.rb:247", "irb (1.3.7) lib/irb/ruby-lex.rb:247", 
"irb (1.3.7) lib/irb/ruby-lex.rb:248", "irb (1.3.7) lib/irb/ruby-lex.rb:248", "irb (1.3.7) lib/irb/ruby-lex.rb:266", "irb (1.3.7) lib/irb.rb:548", "irb (1.3.7) lib/irb.rb:758", "irb (1.3.7) lib/irb.rb:567", "irb (1.3.7) lib/irb/context.rb:450", "irb (1.3.7) lib/irb/workspace.rb:116", "irb (1.3.7) lib/irb/workspace.rb:116", "(irb):2", "sentry-ruby.rb:206", "sentry/hub.rb:114"]>, 
@breadcrumbs=#<Sentry::BreadcrumbBuffer:0x00007fb9245ddee8 @buffer=[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]>>

Closes #1600

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

codecov-commenter commented Nov 5, 2021

Codecov Report

Merging #1602 (ec291c5) into master (1bf154e) will increase coverage by 0.03%.
The diff coverage is 94.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1602      +/-   ##
==========================================
+ Coverage   98.43%   98.46%   +0.03%     
==========================================
  Files         130      131       +1     
  Lines        7223     7242      +19     
==========================================
+ Hits         7110     7131      +21     
+ Misses        113      111       -2     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/interfaces/stacktrace.rb 95.55% <50.00%> (-4.45%) ⬇️
sentry-ruby/lib/sentry/configuration.rb 98.39% <100.00%> (+0.02%) ⬆️
sentry-ruby/lib/sentry/event.rb 100.00% <100.00%> (ø)
...try-ruby/lib/sentry/interfaces/single_exception.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/utils/custom_inspection.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/event_spec.rb 100.00% <100.00%> (ø)
sentry-resque/lib/sentry/resque.rb 100.00% <0.00%> (ø)
sentry-rails/lib/sentry/rails/configuration.rb 100.00% <0.00%> (+3.84%) ⬆️
sentry-ruby/lib/sentry/breadcrumb.rb 100.00% <0.00%> (+4.34%) ⬆️
...ntry/rails/tracing/action_controller_subscriber.rb 94.44% <0.00%> (+4.97%) ⬆️
... and 1 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 1bf154e...ec291c5. Read the comment docs.

@st0012 st0012 removed the wip label Nov 8, 2021
@st0012 st0012 merged commit c4d2623 into master Nov 8, 2021
@st0012 st0012 deleted the fix-#1600 branch November 8, 2021 16:13
4.x automation moved this from In progress to Done Nov 8, 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.

Customize Sentry::Event#inspect
3 participants