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

Add stackprof based profiler #2024

Merged
merged 18 commits into from
Apr 18, 2023
Merged

Add stackprof based profiler #2024

merged 18 commits into from
Apr 18, 2023

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Mar 21, 2023

resolves #2013

Usage

  • Add stackprof to Gemfile as a peer dependency
Sentry.init do |config|
  config.traces_sample_rate = 1.0
  config.profiles_sample_rate = 1.0
  config.release = "release"
end

@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch coverage: 99.22% and project coverage change: +0.01 🎉

Comparison is base (bad263c) 98.58% compared to head (d6ba93f) 98.60%.

❗ Current head d6ba93f differs from pull request most recent head ec0a24f. Consider uploading reports for the commit ec0a24f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2024      +/-   ##
==========================================
+ Coverage   98.58%   98.60%   +0.01%     
==========================================
  Files         157      159       +2     
  Lines       10127    10506     +379     
==========================================
+ Hits         9984    10359     +375     
- Misses        143      147       +4     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/scope.rb 100.00% <ø> (ø)
sentry-ruby/lib/sentry/profiler.rb 97.27% <97.27%> (ø)
sentry-ruby/lib/sentry/configuration.rb 98.62% <100.00%> (+0.04%) ⬆️
sentry-ruby/lib/sentry/envelope.rb 97.95% <100.00%> (ø)
sentry-ruby/lib/sentry/hub.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction_event.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transport.rb 99.05% <100.00%> (+0.01%) ⬆️
sentry-ruby/spec/sentry/configuration_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/profiler_spec.rb 100.00% <100.00%> (ø)
... and 4 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sl0thentr0py sl0thentr0py force-pushed the neel/profiler branch 7 times, most recently from 7c61c0f to 07faa7e Compare April 6, 2023 14:48
@sl0thentr0py sl0thentr0py force-pushed the neel/profiler branch 6 times, most recently from 09ea283 to 39eda29 Compare April 7, 2023 15:47
@sl0thentr0py sl0thentr0py marked this pull request as ready for review April 7, 2023 15:47
@sl0thentr0py sl0thentr0py requested a review from st0012 April 7, 2023 15:47
@sl0thentr0py
Copy link
Member Author

hey @st0012 @Zylphrex I believe this is shippable now, I'll write up a PR description and documentation etc next week, feel free to take a look and start reviewing!

@sl0thentr0py sl0thentr0py changed the title Profiler WIP Add stackprof based profiler Apr 7, 2023
@sl0thentr0py sl0thentr0py force-pushed the neel/profiler branch 2 times, most recently from d368ef1 to e7def50 Compare April 12, 2023 13:31
@sl0thentr0py
Copy link
Member Author

alright I believe I covered all the comments, @st0012

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

IMO using null-object pattern here is an overkill.

Give that:

  1. All public profiler APIs no-op if not @sampled
  2. @sampled will never be true unless @profiling_enabled

Can we do this instead?

  1. Define a single Profiler class
  2. In Profiler's constructor, we use:
@profiling_enabled = defined?(StackProf) && configuration.profiling_enabled?

Alternatively, I think just early returning the initialize method may also work.

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Amazing 🎉

@sl0thentr0py
Copy link
Member Author

ok I did one more round of sanity check testing, looks ok. I'm merging!

@sl0thentr0py sl0thentr0py merged commit 7fd714e into master Apr 18, 2023
@sl0thentr0py sl0thentr0py deleted the neel/profiler branch April 18, 2023 11:23
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.

Profiling for Ruby
3 participants