Skip to content

Commit 6f44215

Browse files
authored
refactor: migrate Python and related guides to inline product options syntax (#13412)
* refactor: migrate python and related guides to inline product options syntax related to #13361
1 parent 0c427cb commit 6f44215

File tree

23 files changed

+146
-30
lines changed

23 files changed

+146
-30
lines changed

docs/platforms/python/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,25 @@ Configuration should happen as **early as possible** in your application's lifec
4141

4242

4343

44-
```python {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
44+
```python
4545
import sentry_sdk
4646

4747
sentry_sdk.init(
4848
dsn="___PUBLIC_DSN___",
4949
# Add request headers and IP for users,
5050
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
5151
send_default_pii=True,
52+
# ___PRODUCT_OPTION_START___ performance
5253
# Set traces_sample_rate to 1.0 to capture 100%
5354
# of transactions for tracing.
5455
traces_sample_rate=1.0,
56+
# ___PRODUCT_OPTION_END___ performance
57+
# ___PRODUCT_OPTION_START___ profiling
5558
# Set profiles_sample_rate to 1.0 to profile 100%
5659
# of sampled transactions.
5760
# We recommend adjusting this value in production.
5861
profiles_sample_rate=1.0,
62+
# ___PRODUCT_OPTION_END___ profiling
5963
)
6064
```
6165

docs/platforms/python/integrations/asgi/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3232
]}
3333
/>
3434

35-
```python {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
35+
```python
3636
import sentry_sdk
3737
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
3838

@@ -43,13 +43,17 @@ sentry_sdk.init(
4343
# Add data like request headers and IP for users, if applicable;
4444
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
4545
send_default_pii=True,
46+
# ___PRODUCT_OPTION_START___ performance
4647
# Set traces_sample_rate to 1.0 to capture 100%
4748
# of transactions for tracing.
4849
traces_sample_rate=1.0,
50+
# ___PRODUCT_OPTION_END___ performance
51+
# ___PRODUCT_OPTION_START___ profiling
4952
# Set profiles_sample_rate to 1.0 to profile 100%
5053
# of sampled transactions.
5154
# We recommend adjusting this value in production.
5255
profiles_sample_rate=1.0,
56+
# ___PRODUCT_OPTION_END___ profiling
5357
)
5458

5559
app = SentryAsgiMiddleware(app)

docs/platforms/python/integrations/asyncio/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If you call `sentry_sdk.init()` outside of an `async` function in an async appli
2929
]}
3030
/>
3131

32-
```python {filename:main.py} {"onboardingOptions": {"performance": "10-12", "profiling": "13-16"}}
32+
```python {filename:main.py}
3333
import sentry_sdk
3434
from sentry_sdk.integrations.asyncio import AsyncioIntegration
3535

@@ -39,13 +39,17 @@ async def main():
3939
# Add data like request headers and IP for users, if applicable;
4040
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
4141
send_default_pii=True,
42+
# ___PRODUCT_OPTION_START___ performance
4243
# Set traces_sample_rate to 1.0 to capture 100%
4344
# of transactions for tracing.
4445
traces_sample_rate=1.0,
46+
# ___PRODUCT_OPTION_END___ performance
47+
# ___PRODUCT_OPTION_START___ profiling
4548
# Set profiles_sample_rate to 1.0 to profile 100%
4649
# of sampled transactions.
4750
# We recommend adjusting this value in production.
4851
profiles_sample_rate=1.0,
52+
# ___PRODUCT_OPTION_END___ profiling
4953
integrations=[
5054
AsyncioIntegration(),
5155
],

docs/platforms/python/integrations/aws-lambda/manual-instrumentation/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
4444
]}
4545
/>
4646

47-
```python {"onboardingOptions": {"performance": "9-11", "profiling": "12-15"}}
47+
```python
4848
import sentry_sdk
4949
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
5050

@@ -53,13 +53,17 @@ sentry_sdk.init(
5353
# Add data like request headers and IP for users, if applicable;
5454
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
5555
send_default_pii=True,
56+
# ___PRODUCT_OPTION_START___ performance
5657
# Set traces_sample_rate to 1.0 to capture 100%
5758
# of transactions for tracing.
5859
traces_sample_rate=1.0,
60+
# ___PRODUCT_OPTION_END___ performance
61+
# ___PRODUCT_OPTION_START___ profiling
5962
# Set profiles_sample_rate to 1.0 to profile 100%
6063
# of sampled transactions.
6164
# We recommend adjusting this value in production.
6265
profiles_sample_rate=1.0,
66+
# ___PRODUCT_OPTION_END___ profiling
6367
integrations=[
6468
AwsLambdaIntegration(),
6569
],

docs/platforms/python/integrations/beam/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
2424
]}
2525
/>
2626

27-
```python {"onboardingOptions": {"performance": "9-11", "profiling": "12-15"}}
27+
```python
2828
import sentry_sdk
2929
from sentry_sdk.integrations.beam import BeamIntegration
3030

@@ -33,13 +33,17 @@ sentry_sdk.init(
3333
# Add data like request headers and IP for users, if applicable;
3434
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
3535
send_default_pii=True,
36+
# ___PRODUCT_OPTION_START___ performance
3637
# Set traces_sample_rate to 1.0 to capture 100%
3738
# of transactions for tracing.
3839
traces_sample_rate=1.0,
40+
# ___PRODUCT_OPTION_END___ performance
41+
# ___PRODUCT_OPTION_START___ profiling
3942
# Set profiles_sample_rate to 1.0 to profile 100%
4043
# of sampled transactions.
4144
# We recommend adjusting this value in production.
4245
profiles_sample_rate=1.0,
46+
# ___PRODUCT_OPTION_END___ profiling
4347
integrations=[
4448
BeamIntegration(),
4549
],

docs/platforms/python/integrations/celery/crons.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
5050
options={["error-monitoring", "performance", "profiling"]}
5151
/>
5252

53-
```python {diff} {filename:tasks.py} {"onboardingOptions": {"performance": "15-17", "profiling": "18-21"}}
53+
```python {diff} {filename:tasks.py}
5454
# tasks.py
5555
from celery import signals
5656

@@ -65,13 +65,17 @@ def init_sentry(**kwargs):
6565
# Add data like request headers and IP for users, if applicable;
6666
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
6767
send_default_pii=True,
68+
# ___PRODUCT_OPTION_START___ performance
6869
# Set traces_sample_rate to 1.0 to capture 100%
6970
# of transactions for tracing.
7071
traces_sample_rate=1.0,
72+
# ___PRODUCT_OPTION_END___ performance
73+
# ___PRODUCT_OPTION_START___ profiling
7174
# Set profiles_sample_rate to 1.0 to profile 100%
7275
# of sampled transactions.
7376
# We recommend adjusting this value in production.
7477
profiles_sample_rate=1.0,
78+
# ___PRODUCT_OPTION_END___ profiling
7579
+ integrations=[
7680
+ CeleryIntegration(
7781
+ monitor_beat_tasks=True

docs/platforms/python/integrations/celery/index.mdx

+11-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In addition to capturing errors, you can use Sentry for [distributed tracing](/c
3535
options={["error-monitoring", "performance", "profiling"]}
3636
/>
3737

38-
```python {filename:tasks.py} {"onboardingOptions": {"performance": "15-17", "profiling": "18-21"}}
38+
```python {filename:tasks.py}
3939
from celery import Celery, signals
4040
import sentry_sdk
4141

@@ -50,13 +50,17 @@ def init_sentry(**_kwargs):
5050
# Add request headers and IP for users,
5151
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
5252
send_default_pii=True,
53+
# ___PRODUCT_OPTION_START___ performance
5354
# Set traces_sample_rate to 1.0 to capture 100%
5455
# of transactions for tracing.
5556
traces_sample_rate=1.0,
57+
# ___PRODUCT_OPTION_END___ performance
58+
# ___PRODUCT_OPTION_START___ profiling
5659
# Set profiles_sample_rate to 1.0 to profile 100%
5760
# of sampled transactions.
5861
# We recommend adjusting this value in production.
5962
profiles_sample_rate=1.0,
63+
# ___PRODUCT_OPTION_END___ profiling
6064
)
6165

6266
# Task definitions go here
@@ -73,7 +77,7 @@ The [`celeryd_init`](https://docs.celeryq.dev/en/stable/userguide/signals.html?#
7377
options={["error-monitoring", "performance", "profiling"]}
7478
/>
7579

76-
```python {filename:main.py} {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
80+
```python {filename:main.py}
7781
from tasks import add
7882
import sentry_sdk
7983

@@ -84,13 +88,17 @@ def main():
8488
# Add data like request headers and IP for users, if applicable;
8589
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
8690
send_default_pii=True,
91+
# ___PRODUCT_OPTION_START___ performance
8792
# Set traces_sample_rate to 1.0 to capture 100%
8893
# of transactions for tracing.
8994
traces_sample_rate=1.0,
95+
# ___PRODUCT_OPTION_END___ performance
96+
# ___PRODUCT_OPTION_START___ profiling
9097
# Set profiles_sample_rate to 1.0 to profile 100%
9198
# of sampled transactions.
9299
# We recommend adjusting this value in production.
93100
profiles_sample_rate=1.0,
101+
# ___PRODUCT_OPTION_END___ profiling
94102
)
95103

96104
# Enqueueing a task to be processed by Celery
@@ -111,7 +119,7 @@ To confirm that your SDK is initialized on worker start, pass `debug=True` to `s
111119

112120
The snippet below includes an intentional `ZeroDivisionError` in the Celery task that will be captured by Sentry. To trigger the error call `debug_sentry.delay()`:
113121

114-
```python {filename:tasks.py} {"onboardingOptions": {"performance": "12-14", "profiling": "15-18"}}
122+
```python {filename:tasks.py}
115123
from celery import Celery, signals
116124
import sentry_sdk
117125

docs/platforms/python/integrations/cloudresourcecontext/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3030
]}
3131
/>
3232

33-
```python {"onboardingOptions": {"performance": "9-11", "profiling": "12-15"}}
33+
```python
3434
import sentry_sdk
3535
from sentry_sdk.integrations.cloud_resource_context import CloudResourceContextIntegration
3636

@@ -39,13 +39,17 @@ sentry_sdk.init(
3939
# Add data like request headers and IP for users, if applicable;
4040
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
4141
send_default_pii=True,
42+
# ___PRODUCT_OPTION_START___ performance
4243
# Set traces_sample_rate to 1.0 to capture 100%
4344
# of transactions for tracing.
4445
traces_sample_rate=1.0,
46+
# ___PRODUCT_OPTION_END___ performance
47+
# ___PRODUCT_OPTION_START___ profiling
4548
# Set profiles_sample_rate to 1.0 to profile 100%
4649
# of sampled transactions.
4750
# We recommend adjusting this value in production.
4851
profiles_sample_rate=1.0,
52+
# ___PRODUCT_OPTION_END___ profiling
4953
integrations=[
5054
CloudResourceContextIntegration(),
5155
],

docs/platforms/python/integrations/django/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,25 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3737
]}
3838
/>
3939

40-
```python {filename:settings.py} {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
40+
```python {filename:settings.py}
4141
import sentry_sdk
4242

4343
sentry_sdk.init(
4444
dsn="___PUBLIC_DSN___",
4545
# Add data like request headers and IP for users;
4646
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
4747
send_default_pii=True,
48+
# ___PRODUCT_OPTION_START___ performance
4849
# Set traces_sample_rate to 1.0 to capture 100%
4950
# of transactions for tracing.
5051
traces_sample_rate=1.0,
52+
# ___PRODUCT_OPTION_END___ performance
53+
# ___PRODUCT_OPTION_START___ profiling
5154
# Set profiles_sample_rate to 1.0 to profile 100%
5255
# of sampled transactions.
5356
# We recommend adjusting this value in production.
5457
profiles_sample_rate=1.0,
58+
# ___PRODUCT_OPTION_END___ profiling
5559
)
5660
```
5761

docs/platforms/python/integrations/gcp-functions/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3535
]}
3636
/>
3737

38-
```python {"onboardingOptions": {"performance": "9-11", "profiling": "12-15"}}
38+
```python
3939
import sentry_sdk
4040
from sentry_sdk.integrations.gcp import GcpIntegration
4141

@@ -44,13 +44,17 @@ sentry_sdk.init(
4444
# Add data like request headers and IP for users, if applicable;
4545
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
4646
send_default_pii=True,
47+
# ___PRODUCT_OPTION_START___ performance
4748
# Set traces_sample_rate to 1.0 to capture 100%
4849
# of transactions for tracing.
4950
traces_sample_rate=1.0,
51+
# ___PRODUCT_OPTION_END___ performance
52+
# ___PRODUCT_OPTION_START___ profiling
5053
# Set profiles_sample_rate to 1.0 to profile 100%
5154
# of sampled transactions.
5255
# We recommend adjusting this value in production.
5356
profiles_sample_rate=1.0,
57+
# ___PRODUCT_OPTION_END___ profiling
5458
integrations=[
5559
GcpIntegration(),
5660
],

docs/platforms/python/integrations/grpc/index.mdx

+10-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3737

3838
### Server
3939

40-
```python {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
40+
```python
4141
import grpc
4242

4343
import sentry_sdk
@@ -48,13 +48,17 @@ sentry_sdk.init(
4848
# Add data like request headers and IP for users, if applicable;
4949
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
5050
send_default_pii=True,
51+
# ___PRODUCT_OPTION_START___ performance
5152
# Set traces_sample_rate to 1.0 to capture 100%
5253
# of transactions for tracing.
5354
traces_sample_rate=1.0,
55+
# ___PRODUCT_OPTION_END___ performance
56+
# ___PRODUCT_OPTION_START___ profiling
5457
# Set profiles_sample_rate to 1.0 to profile 100%
5558
# of sampled transactions.
5659
# We recommend adjusting this value in production.
5760
profiles_sample_rate=1.0,
61+
# ___PRODUCT_OPTION_END___ profiling
5862
integrations=[
5963
GRPCIntegration(),
6064
],
@@ -72,7 +76,7 @@ server = grpc.aio.server()
7276

7377
### Client
7478

75-
```python {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
79+
```python
7680
import grpc
7781

7882
import sentry_sdk
@@ -83,13 +87,17 @@ sentry_sdk.init(
8387
# Add data like request headers and IP for users, if applicable;
8488
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
8589
send_default_pii=True,
90+
# ___PRODUCT_OPTION_START___ performance
8691
# Set traces_sample_rate to 1.0 to capture 100%
8792
# of transactions for tracing.
8893
traces_sample_rate=1.0,
94+
# ___PRODUCT_OPTION_END___ performance
95+
# ___PRODUCT_OPTION_START___ profiling
8996
# Set profiles_sample_rate to 1.0 to profile 100%
9097
# of sampled transactions.
9198
# We recommend adjusting this value in production.
9299
profiles_sample_rate=1.0,
100+
# ___PRODUCT_OPTION_END___ profiling
93101
integrations=[
94102
GRPCIntegration(),
95103
],

docs/platforms/python/integrations/langchain/index.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,25 @@ Select which Sentry features you'd like to install in addition to Error Monitori
4343
]}
4444
/>
4545

46-
```python {"onboardingOptions": {"performance": "9-11", "profiling": "12-15"}}
46+
```python
4747
import sentry_sdk
4848

4949
sentry_sdk.init(
5050
dsn="___PUBLIC_DSN___",
5151
# Send personally-identifiable information like LLM responses to Sentry;
5252
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
5353
send_default_pii=True,
54+
# ___PRODUCT_OPTION_START___ performance
5455
# Set traces_sample_rate to 1.0 to capture 100%
5556
# of transactions for performance monitoring.
5657
traces_sample_rate=1.0,
58+
# ___PRODUCT_OPTION_END___ performance
59+
# ___PRODUCT_OPTION_START___ profiling
5760
# Set profiles_sample_rate to 1.0 to profile 100%
5861
# of sampled transactions.
5962
# We recommend adjusting this value in production.
6063
profiles_sample_rate=1.0,
64+
# ___PRODUCT_OPTION_END___ profiling
6165
)
6266
```
6367

0 commit comments

Comments
 (0)