Skip to content

Commit fb801fd

Browse files
docs(profiling): Update python profiling docs for 1.18.0 (#6649)
Update the docs for python profiling for the latest min version 1.18.0 which moves python profiling out of the experiment option. Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>
1 parent b8ed3da commit fb801fd

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

src/platforms/common/profiling/index.mdx

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,29 @@ The `io.sentry.traces.profiling.sample-rate` setting is _relative_ to the `io.se
151151

152152
<Note>
153153

154-
Python profiling beta is available starting in SDK version `1.16.0`.
154+
Python profiling beta is available starting in SDK version `1.18.0`.
155155

156156
</Note>
157157

158158
```python
159+
import sentry_sdk
160+
161+
def profiles_sampler(sampling_context):
162+
# ...
163+
# return a number between 0 and 1 or a boolean
164+
159165
sentry_sdk.init(
160-
dsn="___DSN___",
161-
traces_sample_rate=1.0,
162-
_experiments={
163-
"profiles_sample_rate": 1.0,
164-
},
166+
dsn="___DSN___",
167+
traces_sample_rate=1.0,
168+
169+
# To set a uniform sample rate
170+
# Set profiles_sample_rate to 1.0 to profile 100%
171+
# of sampled transactions.
172+
# We recommend adjusting this value in production,
173+
profiles_sample_rate=1.0,
174+
175+
# Alternatively, to control sampling dynamically
176+
profiles_sampler=profiles_sampler
165177
)
166178
```
167179

@@ -171,6 +183,20 @@ The <PlatformIdentifier name="profiles_sample_rate" /> setting is _relative_ to
171183

172184
</Note>
173185

186+
### Upgrading from older SDK versions
187+
188+
The feature was experimental prior to version `1.17.0`. To update to the latest SDK, remove `profiles_sample_rate` from `_experiments` and set it in the top-level options.
189+
190+
```python
191+
sentry_sdk.init(
192+
dsn="___DSN___",
193+
traces_sample_rate=1.0,
194+
_experiments={
195+
"profiles_sample_rate": 1.0, # for versions before 1.17.0
196+
},
197+
)
198+
```
199+
174200
</PlatformSection>
175201

176202
<PlatformSection supported={["node"]}>

src/wizard/python/profiling-onboarding/python/1.install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type: language
77

88
#### Install
99

10-
For the Profiling integration to work, you should have the Sentry Python SDK package (minimum version 1.16.0) installed.
10+
For the Profiling integration to work, you should have the Sentry Python SDK package (minimum version 1.18.0) installed.
1111

1212
```bash
1313
pip install --upgrade sentry-sdk

src/wizard/python/profiling-onboarding/python/3.configure-profiling.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ Add the `profiles_sample_rate` option to your SDK config.
1313
import sentry_sdk
1414

1515
sentry_sdk.init(
16-
# ... SDK config
17-
_experiments={
18-
"profiles_sample_rate": 1.0,
19-
}
16+
# ... SDK config
17+
18+
# To set a uniform sample rate
19+
# Set profiles_sample_rate to 1.0 to profile 100%
20+
# of sampled transactions.
21+
# We recommend adjusting this value in production
22+
profiles_sample_rate=1.0,
23+
24+
# Alternatively, to control sampling dynamically
25+
profiles_sampler=profiles_sampler
2026
)
2127
```

0 commit comments

Comments
 (0)