sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

Experimental support for multi-threaded profiling using Vernier

Open solnic opened this issue 1 year ago • 1 comments

Experimental support for Vernier.

Screenshots

Screenshot 2024-08-21 at 13 41 53 Screenshot 2024-08-21 at 13 37 24 Screenshot 2024-08-21 at 13 38 07 Screenshot 2024-08-21 at 13 39 04 Screenshot 2024-08-21 at 13 39 34

solnic avatar Aug 14 '24 18:08 solnic

Codecov Report

Attention: Patch coverage is 99.25558% with 3 lines in your changes missing coverage. Please review.

Project coverage is 98.66%. Comparing base (a070e08) to head (7c8bfb1). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
sentry-ruby/spec/sentry/configuration_spec.rb 71.42% 2 Missing :warning:
sentry-ruby/lib/sentry/configuration.rb 90.90% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2372      +/-   ##
==========================================
- Coverage   98.68%   98.66%   -0.03%     
==========================================
  Files         211      218       +7     
  Lines       13987    14337     +350     
==========================================
+ Hits        13803    14145     +342     
- Misses        184      192       +8     
Components Coverage Δ
sentry-ruby 99.01% <99.25%> (-0.04%) :arrow_down:
sentry-rails 97.34% <ø> (ø)
sentry-sidekiq 97.07% <ø> (ø)
sentry-resque 96.79% <ø> (-0.33%) :arrow_down:
sentry-delayed_job 98.92% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry-ruby.rb 96.72% <100.00%> (+0.01%) :arrow_up:
sentry-ruby/lib/sentry/profiler.rb 100.00% <100.00%> (+0.88%) :arrow_up:
sentry-ruby/lib/sentry/profiler/helpers.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction_event.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/vernier/output.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/vernier/profiler.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/profiler_spec.rb 100.00% <100.00%> (ø)
...y-ruby/spec/sentry/rack/capture_exceptions_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/vernier/profiler_spec.rb 100.00% <100.00%> (ø)
... and 3 more

... and 4 files with indirect coverage changes

codecov[bot] avatar Aug 14 '24 18:08 codecov[bot]

@sl0thentr0py @st0012 thanks for the comments! There are a couple of things that need be fixed. I'll ping you once it's done next week.

solnic avatar Aug 31 '24 10:08 solnic

@solnic we're not requiring the new sentry/vernier/profiler anywhere? We should not force end users to require another obscure path from within the gem, they should all be setup internally.

I would also prefer a warning message in Configuration when people try to set the profiler to vernier but vernier is not installed as a peer dependency gem.

sl0thentr0py avatar Sep 20 '24 12:09 sl0thentr0py

I tried on a simple rails controller with some database calls and the profile is not sent due to being oversized. However, the size limits for a profile payload are much larger (50MB) than for errors/transactions (1MB), so we need to add this logic in Envelope::Item.

sl0thentr0py avatar Sep 20 '24 12:09 sl0thentr0py

@solnic we're not requiring the new sentry/vernier/profiler anywhere? We should not force end users to require another obscure path from within the gem, they should all be setup internally.

I would also prefer a warning message in Configuration when people try to set the profiler to vernier but vernier is not installed as a peer dependency gem.

@sl0thentr0py OK I made it so that sentry/vernier/profiler is required automatically and if you try to set it in the config when vernier is not available, then you'll get a meaningful error message:

3.1.6 :002 > Sentry::Configuration.new.tap { |c| c.profiler_class = Sentry::Vernier::Profiler }
/workspaces/sentry/sentry-ruby/sentry-ruby/lib/sentry/configuration.rb:506:in `rescue in profiler_class=': Please add the 'vernier' gem to your Gemfile to use the Vernier profiler with Sentry. (ArgumentError)
        from /workspaces/sentry/sentry-ruby/sentry-ruby/lib/sentry/configuration.rb:503:in `profiler_class='
        from (irb):2:in `block in <top (required)>'
        from <internal:kernel>:90:in `tap'
        from (irb):2:in `<main>'

solnic avatar Sep 20 '24 16:09 solnic

I tried on a simple rails controller with some database calls and the profile is not sent due to being oversized. However, the size limits for a profile payload are much larger (50MB) than for errors/transactions (1MB), so we need to add this logic in Envelope::Item.

@sl0thentr0py wdym by "this logic" exactly?

solnic avatar Sep 20 '24 17:09 solnic

we need to generalize this logic to have different limits according to different envelope item.type but let's make a separate issue/PR for that.

sl0thentr0py avatar Sep 23 '24 15:09 sl0thentr0py

@sl0thentr0py alright this is now using the increased envelope profile item limit

solnic avatar Sep 30 '24 12:09 solnic

omg the profiles look perfect <3

sl0thentr0py avatar Oct 04 '24 13:10 sl0thentr0py

@sl0thentr0py yessssss! Thanks for the reviews and testing! Let's 🚢 it 😄

solnic avatar Oct 04 '24 14:10 solnic