Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Continuous Profiling - Add delayed stop #4293

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

Merged
merged 10 commits into from
Apr 7, 2025

Conversation

stefanosiano
Copy link
Member

📜 Description

Replaced synchronized blocks with AutoClosableReentrantLock in AndroidContinuousProfiler - unrelated to delayed stop, but small enough to be added in this PR
Added "delayed" stop of profiler, which stops the profiler after the current chunk is finished
Added default span data (profiler id, thread name and thread id) to transaction root span - unrelated to delayed stop, but this was causing the ui.load span to not have the thread id and thread name attached, breaking the link to the continuous profile. A fix is already deployed on the frontend, which fallbacks to the main thread in such cases, but we should still fix it anyway in the SDK

💡 Motivation and Context

The goal of continuous profiling is to send profile chunks 1 minute long, as it's more efficient to store few large chunks than multiple small chunks. To avoid the case when a profiler is started and stopped multiple times in the minute time range, causing multiple small chunks to be captured, we now wait until the chunk is finished to stop the profiler.
Note: closing the SDK through Sentry.close() doesn't wait anything

💚 How did you test it?

Unit tests

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Added platform "android" in ProfileChunk envelope items
…dContinuousProfiler

Added "delayed" stop of profiler, which stops the profiler after the current chunk is finished
Added default span data (profiler id, thread name and thread id) to transaction root span
Copy link
Contributor

github-actions bot commented Mar 27, 2025

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

Generated by 🚫 dangerJS against cfadb1a

@stefanosiano stefanosiano marked this pull request as ready for review March 27, 2025 10:37
Copy link
Contributor

github-actions bot commented Mar 27, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 406.41 ms 421.22 ms 14.82 ms
Size 1.58 MiB 2.08 MiB 505.33 KiB

Previous results on branch: feat/continuous-profiling-delayed-stop

Startup times

Revision Plain With Sentry Diff
a948dac 406.28 ms 452.18 ms 45.91 ms
ea6dc38 409.39 ms 488.18 ms 78.79 ms

App size

Revision Plain With Sentry Diff
a948dac 1.58 MiB 2.22 MiB 653.05 KiB
ea6dc38 1.58 MiB 2.08 MiB 505.31 KiB

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

LGTM!

@stefanosiano stefanosiano enabled auto-merge (squash) April 7, 2025 09:05
@stefanosiano stefanosiano merged commit 5c3cd7a into main Apr 7, 2025
34 checks passed
@stefanosiano stefanosiano deleted the feat/continuous-profiling-delayed-stop branch April 7, 2025 09:18
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