Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/platforms/python/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Profiling was experimental in SDK versions `1.17.0` and older. Learn how to upgr

<Include name="feature-stage-beta.mdx" />

_(New in version 2.21.0)_
_(New in version 2.23.0)_
Copy link
Member Author

Choose a reason for hiding this comment

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

Double check this is the correct sdk version once it has been released. Should include up to getsentry/sentry-python#4079

Copy link
Contributor

Choose a reason for hiding this comment

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

The export PR has been merged, so 2.23.0 will be the correct version.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 going to wait for 2.23.0 to release then

Copy link
Member Author

Choose a reason for hiding this comment

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

Bumped to 2.24.1 as that includes some necessary fixes.


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

Expand All @@ -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
Expand All @@ -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",
)
```

Expand Down