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

feat(profiling): add API to SentrySDK to start/stop a continuous profiling session #3834

Merged

Conversation

armcknight
Copy link
Member

@armcknight armcknight commented Apr 5, 2024

And thread it through to a stub for new implementation for the continuous profiler.

Add a check for where the legacy profiler is started from SentryTracer for the new feature flag.

TODO

- [ ] Haven't decided what to do yet with the launch profiler; I think it will also need the feature flag at the spots that automatically stop the tracer managing it, so it is left running throughout the app session or until SentrySDK.stopProfiler is called.
- [ ] just learned (April 5) that we will automatically start profiling from SentrySDK.startWithOptions (if launch profiling isn't enabled) which will respect profiles sample rate, so this needs to be added here or in a subsequent PR
I am just going to leave this PR as the stub for the new continuous profiler and leave it to a future PR to deliver the implementation of automatic/manual start/stop.

#skip-changelog

for #3555

…ing new public API

- there was already a SentryProfiler+Private.h; split up what was in there between the new one (nee SentryProfiler.h) and SentryProfiler+Test.h, depending on where the declarations are actually needed
- there were also two SentryProfiler+Test.h files: one in the SDK, and one in the test utils lib; remove the one in the SDK, and move its declarations to the one in the test lib along with the appropriate ones moved from the old SentryProfiler+Private.h that was deleted to make way for renaming SentryProfiler.h to SentryProfiler+Private.h
Copy link

github-actions bot commented Apr 5, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against e74d85b

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 90.627%. Comparing base (3de9971) to head (e74d85b).
Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #3834       +/-   ##
=============================================
- Coverage   90.957%   90.627%   -0.331%     
=============================================
  Files          560       579       +19     
  Lines        44271     45240      +969     
  Branches     15776     16098      +322     
=============================================
+ Hits         40268     41000      +732     
- Misses        3822      4060      +238     
+ Partials       181       180        -1     
Files Coverage Δ
Sources/Sentry/SentryProfiler.mm 85.333% <ø> (ø)
Sources/Sentry/SentryTracer.m 96.658% <ø> (ø)
...ources/Sentry/Profiling/SentryContinuousProfiler.m 0.000% <0.000%> (ø)
Sources/Sentry/SentrySDK.m 86.470% <0.000%> (-5.405%) ⬇️

... and 40 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3de9971...e74d85b. Read the comment docs.

Copy link

github-actions bot commented Apr 5, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1245.19 ms 1261.57 ms 16.38 ms
Size 21.58 KiB 612.82 KiB 591.24 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
4b1a58e 1237.39 ms 1265.63 ms 28.23 ms
d10ae0c 1250.02 ms 1253.74 ms 3.72 ms
0559a8f 1239.78 ms 1252.60 ms 12.83 ms
dcec216 1238.94 ms 1261.06 ms 22.12 ms
4bca912 1252.42 ms 1260.06 ms 7.64 ms
42ef6ba 1234.35 ms 1252.29 ms 17.94 ms
ca91a5c 1234.53 ms 1249.86 ms 15.33 ms
aeec206 1211.31 ms 1229.18 ms 17.87 ms
83887af 1196.94 ms 1206.82 ms 9.88 ms
4259afd 1222.12 ms 1249.74 ms 27.62 ms

App size

Revision Plain With Sentry Diff
4b1a58e 22.85 KiB 407.02 KiB 384.17 KiB
d10ae0c 20.76 KiB 419.86 KiB 399.10 KiB
0559a8f 21.58 KiB 419.81 KiB 398.23 KiB
dcec216 20.76 KiB 432.88 KiB 412.11 KiB
4bca912 22.85 KiB 411.14 KiB 388.29 KiB
42ef6ba 21.58 KiB 417.86 KiB 396.28 KiB
ca91a5c 22.84 KiB 403.19 KiB 380.34 KiB
aeec206 20.76 KiB 434.88 KiB 414.12 KiB
83887af 21.58 KiB 419.64 KiB 398.06 KiB
4259afd 20.76 KiB 419.70 KiB 398.94 KiB

Previous results on branch: armcknight/feat/3555-continuous-profiling/3-new-public-api

Startup times

Revision Plain With Sentry Diff
77de107 1234.90 ms 1246.52 ms 11.62 ms

App size

Revision Plain With Sentry Diff
77de107 21.58 KiB 574.89 KiB 553.31 KiB

@armcknight armcknight marked this pull request as draft April 5, 2024 19:32
@armcknight armcknight marked this pull request as ready for review April 9, 2024 11:51
…continuous-profiling/2-privatize-existing-api
…xisting-api' into armcknight/feat/3555-continuous-profiling/3-new-public-api
Base automatically changed from armcknight/feat/3555-continuous-profiling/2-privatize-existing-api to main April 10, 2024 20:04
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

LGTM

Sources/Sentry/SentryTracer.m Outdated Show resolved Hide resolved
Sources/Sentry/include/SentrySDK+Private.h Show resolved Hide resolved
@armcknight armcknight merged commit 88ca9d8 into main Apr 12, 2024
68 of 70 checks passed
@armcknight armcknight deleted the armcknight/feat/3555-continuous-profiling/3-new-public-api branch April 12, 2024 01:16
dKasabwala pushed a commit to dKasabwala/sentry-cocoa that referenced this pull request May 6, 2024
threema-matteo pushed a commit to threema-ch/sentry-cocoa that referenced this pull request May 21, 2024
Sign up for free to 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.

2 participants