Skip to content

Add stackprof based profiler - #2024

Merged
sl0thentr0py merged 18 commits into
masterfrom
neel/profiler
Apr 18, 2023
Merged

Add stackprof based profiler#2024
sl0thentr0py merged 18 commits into
masterfrom
neel/profiler

Conversation

@sl0thentr0py

@sl0thentr0pysl0thentr0py commented Mar 21, 2023

Copy link
Copy Markdown
Member

resolves#2013

Usage

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

@sl0thentr0pysl0thentr0py mentioned this pull request Mar 22, 2023
@sl0thentr0py
sl0thentr0pyforce-pushed the neel/profiler branch 3 times, most recently from 2bba702 to 4a747e8CompareMarch 29, 2023 14:20
@codecov

codecovBot commented Mar 30, 2023

Copy link
Copy Markdown

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 FilesCoverage Δ
sentry-ruby/lib/sentry/scope.rb100.00% <ø> (ø)
sentry-ruby/lib/sentry/profiler.rb97.27% <97.27%> (ø)
sentry-ruby/lib/sentry/configuration.rb98.62% <100.00%> (+0.04%)⬆️
sentry-ruby/lib/sentry/envelope.rb97.95% <100.00%> (ø)
sentry-ruby/lib/sentry/hub.rb100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction.rb100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction_event.rb100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transport.rb99.05% <100.00%> (+0.01%)⬆️
sentry-ruby/spec/sentry/configuration_spec.rb100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/profiler_spec.rb100.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
sl0thentr0pyforce-pushed the neel/profiler branch 7 times, most recently from 7c61c0f to 07faa7eCompareApril 6, 2023 14:48
@sl0thentr0py
sl0thentr0pyforce-pushed the neel/profiler branch 6 times, most recently from 09ea283 to 39eda29CompareApril 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 st0012April 7, 2023 15:47
@sl0thentr0py

Copy link
Copy Markdown
MemberAuthor

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!

@sl0thentr0pysl0thentr0py changed the title Profiler WIPAdd stackprof based profilerApr 7, 2023
@sl0thentr0py
sl0thentr0pyforce-pushed the neel/profiler branch 2 times, most recently from d368ef1 to e7def50CompareApril 12, 2023 13:31
@sl0thentr0py

Copy link
Copy Markdown
MemberAuthor

alright I believe I covered all the comments, @st0012

@st0012st0012 left a comment

Copy link
Copy Markdown
Contributor

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.

@st0012st0012 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amazing 🎉

@sl0thentr0py

Copy link
Copy Markdown
MemberAuthor

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

@sl0thentr0py
sl0thentr0py merged commit 7fd714e into masterApr 18, 2023
@sl0thentr0py
sl0thentr0py deleted the neel/profiler branch April 18, 2023 11:23
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profiling for Ruby

3 participants

@sl0thentr0py@st0012@Zylphrex