From 043d7893b9c438254a42b869073c5cbe4d8ca017 Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Wed, 19 Feb 2025 16:23:34 -0500 Subject: [PATCH 1/4] feat(profiling): Update python continuous profiling docs This should now use the `start_profile_session` and `stop_profile_session` apis and mention `profile_lifecycle="trace"`. --- docs/platforms/python/profiling/index.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/platforms/python/profiling/index.mdx b/docs/platforms/python/profiling/index.mdx index 85a02fe666989..6fd5a19026261 100644 --- a/docs/platforms/python/profiling/index.mdx +++ b/docs/platforms/python/profiling/index.mdx @@ -59,11 +59,11 @@ Profiling was experimental in SDK versions `1.17.0` and older. Learn how to upgr -_(New in version 2.21.0)_ +_(New in version 2.23.0)_ The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit on how long the profiler may run. -To get started with continuous profiling, you can start and stop the profiler directly with `sentry_sdk.profiler.start_profiler` and `sentry_sdk.profiler.stop_profiler`. +To get started with continuous profiling, you can start and stop the profiler directly with `sentry_sdk.profiler.start_profile_session` and `sentry_sdk.profiler.stop_profile_session`. ### Sampling @@ -89,14 +89,14 @@ sentry_sdk.init( profile_session_sample_rate=1.0, ) -sentry_sdk.profiler.start_profiler() +sentry_sdk.profiler.start_profile_session() # run some code here -sentry_sdk.profiler.stop_profiler() +sentry_sdk.profiler.stop_profile_session() ``` -For some applications such as web servers, it may be difficult to call `sentry_sdk.profiler.start_profiler` in every process. Instead, you can use the `continuous_profiling_auto_start` option to automatically start the continuous profiler when a transaction is started. +For some applications such as web servers, it may be difficult to call `sentry_sdk.profiler.start_profile_session` in every process. Instead, you can use the `profile_lifecycle` option to automatically profile anytime a transaction is active. ```python import sentry_sdk @@ -105,9 +105,9 @@ sentry_sdk.init( dsn="___PUBLIC_DSN___", send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "continuous_profiling_auto_start": True, - }, + # To collect profiles for all profile sessions, set `profile_session_sample_rate` to 1.0. + profile_session_sample_rate=1.0, + profile_lifecycle="trace", ) ``` From 5bf1ec495ecdc46ee7e97b4f5f4e7e5f5faae493 Mon Sep 17 00:00:00 2001 From: JonasBa Date: Mon, 17 Mar 2025 10:05:13 -0400 Subject: [PATCH 2/4] profiling: set version to 2.23.1 --- docs/platforms/python/profiling/index.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/platforms/python/profiling/index.mdx b/docs/platforms/python/profiling/index.mdx index 6fd5a19026261..31c0303d3c4cc 100644 --- a/docs/platforms/python/profiling/index.mdx +++ b/docs/platforms/python/profiling/index.mdx @@ -15,7 +15,6 @@ Python profiling is stable as of SDK version `1.18.0`. - ```python import sentry_sdk @@ -59,7 +58,7 @@ Profiling was experimental in SDK versions `1.17.0` and older. Learn how to upgr -_(New in version 2.23.0)_ +_(New in version 2.23.1)_ The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit on how long the profiler may run. From 1eb8cd4ee5b15996cd4393a7aaa368e179d9fb14 Mon Sep 17 00:00:00 2001 From: Francesco Vigliaturo Date: Wed, 19 Mar 2025 14:19:00 +0100 Subject: [PATCH 3/4] replace start_profile_session and stop_profile_session with start_profiler and stop_profiler --- docs/platforms/python/profiling/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/python/profiling/index.mdx b/docs/platforms/python/profiling/index.mdx index 31c0303d3c4cc..a5eb0160f1ac9 100644 --- a/docs/platforms/python/profiling/index.mdx +++ b/docs/platforms/python/profiling/index.mdx @@ -62,7 +62,7 @@ _(New in version 2.23.1)_ The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit on how long the profiler may run. -To get started with continuous profiling, you can start and stop the profiler directly with `sentry_sdk.profiler.start_profile_session` and `sentry_sdk.profiler.stop_profile_session`. +To get started with continuous profiling, you can start and stop the profiler directly with `sentry_sdk.profiler.start_profiler` and `sentry_sdk.profiler.stop_profiler`. ### Sampling @@ -88,14 +88,14 @@ sentry_sdk.init( profile_session_sample_rate=1.0, ) -sentry_sdk.profiler.start_profile_session() +sentry_sdk.profiler.start_profiler() # run some code here -sentry_sdk.profiler.stop_profile_session() +sentry_sdk.profiler.stop_profiler() ``` -For some applications such as web servers, it may be difficult to call `sentry_sdk.profiler.start_profile_session` in every process. Instead, you can use the `profile_lifecycle` option to automatically profile anytime a transaction is active. +For some applications such as web servers, it may be difficult to call `sentry_sdk.profiler.start_profiler` in every process. Instead, you can use the `profile_lifecycle` option to automatically profile anytime a transaction is active. ```python import sentry_sdk From 314165a43793dd59f538ba37db1aec3502eceeee Mon Sep 17 00:00:00 2001 From: Francesco Vigliaturo Date: Mon, 24 Mar 2025 18:14:33 +0100 Subject: [PATCH 4/4] update python sdk version for continuous profiling this should be the minimum version --- docs/platforms/python/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/python/profiling/index.mdx b/docs/platforms/python/profiling/index.mdx index a5eb0160f1ac9..aa36c1ad751e8 100644 --- a/docs/platforms/python/profiling/index.mdx +++ b/docs/platforms/python/profiling/index.mdx @@ -58,7 +58,7 @@ Profiling was experimental in SDK versions `1.17.0` and older. Learn how to upgr -_(New in version 2.23.1)_ +_(New in version 2.24.1)_ The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit on how long the profiler may run.