Skip to content

Commit 4b359c6

Browse files
committed
chore(profiling): Update python profiling docs for new SDK
This uses the updated python sdk where - `start_profiler` is replaced by `start_profile_session` - `stop_profiler` is replaced by `stop_profiler_session` - `_experiments["continuous_profiling_auto_start"]` is replaced by `profile_lifecycle` - this differs slightly to only profile traces instead of all the time
1 parent c2fedd8 commit 4b359c6

38 files changed

+127
-187
lines changed

static/app/gettingStartedDocs/python/aiohttp.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ describe('aiohttp onboarding docs', function () {
4242

4343
// Does not render continuous profiling config
4444
expect(
45-
screen.queryByText(
46-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
47-
)
45+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
4846
).not.toBeInTheDocument();
4947

5048
// Does render transaction profiling config
@@ -75,7 +73,7 @@ describe('aiohttp onboarding docs', function () {
7573

7674
// Does render continuous profiling config
7775
const matches = screen.getAllByText(
78-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
76+
textWithMarkupMatcher(/profile_lifecycle: "trace"/)
7977
);
8078
expect(matches.length).toBeGreaterThan(0);
8179
matches.forEach(match => expect(match).toBeInTheDocument());

static/app/gettingStartedDocs/python/aiohttp.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,9 @@ sentry_sdk.init(
4848
: params.isProfilingSelected &&
4949
params.profilingOptions?.defaultProfilingMode === 'continuous'
5050
? `
51-
_experiments={
52-
# Set continuous_profiling_auto_start to True
53-
# to automatically start the profiler when
54-
# possible.
55-
"continuous_profiling_auto_start": True,
56-
},`
51+
# Set profile_lifecycle to "trace" to automatically
52+
# run the profiler on when there is an active transaction
53+
profile_lifecycle: "trace",`
5754
: ''
5855
}
5956
)

static/app/gettingStartedDocs/python/asgi.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ describe('asgi onboarding docs', function () {
4242

4343
// Does not render continuous profiling config
4444
expect(
45-
screen.queryByText(
46-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
47-
)
45+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
4846
).not.toBeInTheDocument();
4947

5048
// Does render transaction profiling config
@@ -73,7 +71,7 @@ describe('asgi onboarding docs', function () {
7371

7472
// Does render continuous profiling config
7573
expect(
76-
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
74+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
7775
).toBeInTheDocument();
7876
});
7977
});

static/app/gettingStartedDocs/python/asgi.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ sentry_sdk.init(
4646
: params.isProfilingSelected &&
4747
params.profilingOptions?.defaultProfilingMode === 'continuous'
4848
? `
49-
_experiments={
50-
# Set continuous_profiling_auto_start to True
51-
# to automatically start the profiler on when
52-
# possible.
53-
"continuous_profiling_auto_start": True,
54-
},`
49+
# Set profile_lifecycle to "trace" to automatically
50+
# run the profiler on when there is an active transaction
51+
profile_lifecycle: "trace",`
5552
: ''
5653
}
5754
)

static/app/gettingStartedDocs/python/awslambda.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ describe('awslambda onboarding docs', function () {
4242

4343
// Does not render continuous profiling config
4444
expect(
45-
screen.queryByText(
46-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
47-
)
45+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
4846
).not.toBeInTheDocument();
4947

5048
// Does render transaction profiling config
@@ -73,7 +71,7 @@ describe('awslambda onboarding docs', function () {
7371

7472
// Does render continuous profiling config
7573
expect(
76-
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
74+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
7775
).toBeInTheDocument();
7876
});
7977
});

static/app/gettingStartedDocs/python/awslambda.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ sentry_sdk.init(
5454
: params.isProfilingSelected &&
5555
params.profilingOptions?.defaultProfilingMode === 'continuous'
5656
? `
57-
_experiments={
58-
# Set continuous_profiling_auto_start to True
59-
# to automatically start the profiler on when
60-
# possible.
61-
"continuous_profiling_auto_start": True,
62-
},`
57+
# Set profile_lifecycle to "trace" to automatically
58+
# run the profiler on when there is an active transaction
59+
profile_lifecycle: "trace",`
6360
: ''
6461
}
6562
)

static/app/gettingStartedDocs/python/bottle.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ describe('bottle onboarding docs', function () {
4444

4545
// Does not render continuous profiling config
4646
expect(
47-
screen.queryByText(
48-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
49-
)
47+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle: "trace",/))
5048
).not.toBeInTheDocument();
5149

5250
// Does render transaction profiling config
@@ -77,7 +75,7 @@ describe('bottle onboarding docs', function () {
7775

7876
// Does render continuous profiling config
7977
const matches = screen.getAllByText(
80-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
78+
textWithMarkupMatcher(/profile_lifecycle: "trace",/)
8179
);
8280
expect(matches.length).toBeGreaterThan(0);
8381
matches.forEach(match => expect(match).toBeInTheDocument());

static/app/gettingStartedDocs/python/bottle.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ sentry_sdk.init(
4646
: params.isProfilingSelected &&
4747
params.profilingOptions?.defaultProfilingMode === 'continuous'
4848
? `
49-
_experiments={
50-
# Set continuous_profiling_auto_start to True
51-
# to automatically start the profiler on when
52-
# possible.
53-
"continuous_profiling_auto_start": True,
54-
},`
49+
# Set profile_lifecycle to "trace" to automatically
50+
# run the profiler on when there is an active transaction
51+
profile_lifecycle: "trace",`
5552
: ''
5653
}
5754
)

static/app/gettingStartedDocs/python/celery.spec.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@ describe('celery onboarding docs', function () {
4646

4747
// Does not render continuous profiling config
4848
expect(
49-
screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
49+
screen.queryByText(
50+
textWithMarkupMatcher(/sentry_sdk.profiler.start_profile_session\(\)/)
51+
)
5052
).not.toBeInTheDocument();
5153
expect(
52-
screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
54+
screen.queryByText(
55+
textWithMarkupMatcher(/sentry_sdk.profiler.stop_profile_session\(\)/)
56+
)
5357
).not.toBeInTheDocument();
5458

5559
// Does render transaction profiling config
@@ -78,10 +82,14 @@ describe('celery onboarding docs', function () {
7882

7983
// Does render continuous profiling config
8084
expect(
81-
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
85+
screen.getByText(
86+
textWithMarkupMatcher(/sentry_sdk.profiler.start_profile_session\(\)/)
87+
)
8288
).toBeInTheDocument();
8389
expect(
84-
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
90+
screen.getByText(
91+
textWithMarkupMatcher(/sentry_sdk.profiler.stop_profile_session\(\)/)
92+
)
8593
).toBeInTheDocument();
8694
});
8795
});

static/app/gettingStartedDocs/python/celery.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ sentry_sdk.init(
5151
params.profilingOptions?.defaultProfilingMode === 'continuous'
5252
? `
5353
54-
# Manually call start_profiler and stop_profiler
54+
# Manually call start_profile_session and stop_profile_session
5555
# to profile the code in between
56-
sentry_sdk.profiler.start_profiler()
56+
sentry_sdk.profiler.start_profile_session()
5757
# this code will be profiled
5858
#
59-
# Calls to stop_profiler are optional - if you don't stop the profiler, it will keep profiling
60-
# your application until the process exits or stop_profiler is called.
61-
sentry_sdk.profiler.stop_profiler()`
59+
# Calls to stop_profile_session are optional - if you don't stop the profiler, it will keep profiling
60+
# your application until the process exits or stop_profile_session is called.
61+
sentry_sdk.profiler.stop_profile_session()`
6262
: ''
6363
}`;
6464

0 commit comments

Comments
 (0)