Skip to content

Remove verbose data from #inspect result#1602

Merged
st0012 merged 4 commits intomasterfrom
fix-#1600
Nov 8, 2021
Merged

Remove verbose data from #inspect result#1602
st0012 merged 4 commits intomasterfrom
fix-#1600

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@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

Details
#<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
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 5, 2021

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.45%. Comparing base (602864f) to head (90428a6).
⚠️ Report is 704 commits behind head on master.

Files with missing lines Patch % Lines
sentry-ruby/lib/sentry/interfaces/stacktrace.rb 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1602      +/-   ##
==========================================
- Coverage   98.47%   98.45%   -0.03%     
==========================================
  Files         130      131       +1     
  Lines        7208     7243      +35     
==========================================
+ Hits         7098     7131      +33     
- Misses        110      112       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customize Sentry::Event#inspect

3 participants