feat(node): add continuous profiling mode
This PR introduce a new continuous profiling mode. This mode is exclusive from the current mode which considers starting and stopping profiles on a per span basis.
I've picked the interval duration of 5s as somewhat arbitrarily. The idea is that we dont want profiles to grow too large, because that might become a performance issue in the event that we have a lot of deep stack samples to process.
Since profiling mode is exclusive, we will require users to add a profilerMode (subject to change) as the SDK option (this is subject to change as we align the APIs cross sdks). In terms of convenience, we are likely also going to add a Sentry.profiler.start/stop methods so that users can have access as to when they can start and stop the profiler (not implemented as we havent standardized on the approach yet) - currently this relies on getIntegrationByName("ProfilingIntegration").profiler.stop
Since the UI does not support this mode yet, I will hide the profilerMode hidden and only allow the current automated instrumentation
size-limit report 📦
| Path | Size |
|---|---|
| @sentry/browser | 21.74 KB (+0.04% 🔺) |
| @sentry/browser (incl. Tracing) | 32.78 KB (+0.03% 🔺) |
| @sentry/browser (incl. Tracing, Replay) | 68.35 KB (+0.02% 🔺) |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 61.66 KB (+0.02% 🔺) |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 72.41 KB (+0.02% 🔺) |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 84.51 KB (+0.01% 🔺) |
| @sentry/browser (incl. Tracing, Replay, Feedback, metrics) | 86.37 KB (+0.01% 🔺) |
| @sentry/browser (incl. metrics) | 25.93 KB (+0.04% 🔺) |
| @sentry/browser (incl. Feedback) | 37.9 KB (+0.03% 🔺) |
| @sentry/browser (incl. sendFeedback) | 26.33 KB (+0.04% 🔺) |
| @sentry/browser (incl. FeedbackAsync) | 30.87 KB (+0.03% 🔺) |
| @sentry/react | 24.52 KB (+0.04% 🔺) |
| @sentry/react (incl. Tracing) | 35.82 KB (+0.02% 🔺) |
| @sentry/vue | 25.74 KB (+0.04% 🔺) |
| @sentry/vue (incl. Tracing) | 34.61 KB (+0.02% 🔺) |
| @sentry/svelte | 21.87 KB (+0.04% 🔺) |
| CDN Bundle | 23.12 KB (+0.04% 🔺) |
| CDN Bundle (incl. Tracing) | 34.51 KB (+0.02% 🔺) |
| CDN Bundle (incl. Tracing, Replay) | 68.44 KB (+0.01% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 73.61 KB (+0.02% 🔺) |
| CDN Bundle - uncompressed | 68.02 KB (+0.04% 🔺) |
| CDN Bundle (incl. Tracing) - uncompressed | 102.2 KB (+0.03% 🔺) |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 212.09 KB (+0.02% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 224.56 KB (+0.02% 🔺) |
| @sentry/nextjs (client) | 35.17 KB (+0.03% 🔺) |
| @sentry/sveltekit (client) | 33.41 KB (+0.03% 🔺) |
| @sentry/node | 115.25 KB (+0.01% 🔺) |
| @sentry/node - without tracing | 94.56 KB (+0.01% 🔺) |
| @sentry/aws-serverless | 103.73 KB (+0.01% 🔺) |
I feel like we could do a better job explaining this new mode. It is not clear to me from reading this PR description or the JSDoc when exactly the profiling starts and when it stops.
Agree @lforst. We dont plan to expose this API yet and I'm going to write a doc on how exactly we want to do this so we can standardize it cross sdks. I'll share the doc with you so you can give us some input as well. The plan here is to just add the underlying functionality without exposing it to the users as the product doesnt even support it yet.
Thanks @AbhiPrasad. I'm happy to make changes down the line if we need to as well