Skip to content

Commit 9bdc476

Browse files
Zylphrexandrewshie-sentry
authored andcommitted
feat(profiling): Update onboarding docs for python profiling (#88328)
This updates the in app onboarding docs for python profiling.
1 parent 40c5f00 commit 9bdc476

39 files changed

+336
-265
lines changed

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

+14-14
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,16 @@ 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_session_sample_rate=1\.0,/))
46+
).not.toBeInTheDocument();
47+
expect(
48+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
4849
).not.toBeInTheDocument();
4950

5051
// Does render transaction profiling config
51-
const matches = screen.getAllByText(
52-
textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
53-
);
54-
expect(matches.length).toBeGreaterThan(0);
55-
matches.forEach(match => expect(match).toBeInTheDocument());
52+
expect(
53+
screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
54+
).toBeInTheDocument();
5655
});
5756

5857
it('renders continuous profiling', function () {
@@ -70,14 +69,15 @@ describe('aiohttp onboarding docs', function () {
7069

7170
// Does not render transaction profiling config
7271
expect(
73-
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
72+
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
7473
).not.toBeInTheDocument();
7574

7675
// Does render continuous profiling config
77-
const matches = screen.getAllByText(
78-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
79-
);
80-
expect(matches.length).toBeGreaterThan(0);
81-
matches.forEach(match => expect(match).toBeInTheDocument());
76+
expect(
77+
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
78+
).toBeInTheDocument();
79+
expect(
80+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
81+
).toBeInTheDocument();
8282
});
8383
});

static/app/gettingStartedDocs/python/aiohttp.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ 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_session_sample_rate to 1.0 to profile 100%
52+
# of profile sessions.
53+
profile_session_sample_rate=1.0,
54+
# Set profile_lifecycle to "trace" to automatically
55+
# run the profiler on when there is an active transaction
56+
profile_lifecycle="trace",`
5757
: ''
5858
}
5959
)
@@ -78,7 +78,7 @@ const onboarding: OnboardingConfig = {
7878
description:
7979
params.docsLocation === DocsPageLocation.PROFILING_PAGE
8080
? tct(
81-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
81+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
8282
{
8383
code: <code />,
8484
}

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ 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_session_sample_rate=1\.0,/))
46+
).not.toBeInTheDocument();
47+
expect(
48+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
4849
).not.toBeInTheDocument();
4950

5051
// Does render transaction profiling config
@@ -73,7 +74,10 @@ describe('asgi onboarding docs', function () {
7374

7475
// Does render continuous profiling config
7576
expect(
76-
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
77+
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
78+
).toBeInTheDocument();
79+
expect(
80+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
7781
).toBeInTheDocument();
7882
});
7983
});

static/app/gettingStartedDocs/python/asgi.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ 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_session_sample_rate to 1.0 to profile 100%
50+
# of profile sessions.
51+
profile_session_sample_rate=1.0,
52+
# Set profile_lifecycle to "trace" to automatically
53+
# run the profiler on when there is an active transaction
54+
profile_lifecycle="trace",`
5555
: ''
5656
}
5757
)
@@ -102,7 +102,7 @@ const onboarding: OnboardingConfig = {
102102
description:
103103
params.docsLocation === DocsPageLocation.PROFILING_PAGE
104104
? tct(
105-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
105+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
106106
{
107107
code: <code />,
108108
}

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ 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_session_sample_rate=1\.0,/))
46+
).not.toBeInTheDocument();
47+
expect(
48+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
4849
).not.toBeInTheDocument();
4950

5051
// Does render transaction profiling config
@@ -73,7 +74,10 @@ describe('awslambda onboarding docs', function () {
7374

7475
// Does render continuous profiling config
7576
expect(
76-
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
77+
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
78+
).toBeInTheDocument();
79+
expect(
80+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
7781
).toBeInTheDocument();
7882
});
7983
});

static/app/gettingStartedDocs/python/awslambda.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ 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_session_sample_rate to 1.0 to profile 100%
58+
# of profile sessions.
59+
profile_session_sample_rate=1.0,
60+
# Set profile_lifecycle to "trace" to automatically
61+
# run the profiler on when there is an active transaction
62+
profile_lifecycle="trace",`
6363
: ''
6464
}
6565
)
@@ -94,7 +94,7 @@ const onboarding: OnboardingConfig<PlatformOptions> = {
9494
description:
9595
params.docsLocation === DocsPageLocation.PROFILING_PAGE
9696
? tct(
97-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
97+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
9898
{
9999
code: <code />,
100100
}

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

+14-8
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ 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_session_sample_rate=1\.0,/))
48+
).not.toBeInTheDocument();
49+
expect(
50+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
5051
).not.toBeInTheDocument();
5152

5253
// Does render transaction profiling config
@@ -72,14 +73,19 @@ describe('bottle onboarding docs', function () {
7273

7374
// Does not render transaction profiling config
7475
expect(
75-
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
76+
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
7677
).not.toBeInTheDocument();
7778

7879
// Does render continuous profiling config
79-
const matches = screen.getAllByText(
80-
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
80+
const sampleRateMatches = screen.getAllByText(
81+
textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/)
8182
);
82-
expect(matches.length).toBeGreaterThan(0);
83-
matches.forEach(match => expect(match).toBeInTheDocument());
83+
expect(sampleRateMatches.length).toBeGreaterThan(0);
84+
sampleRateMatches.forEach(match => expect(match).toBeInTheDocument());
85+
const lifecycleMatches = screen.getAllByText(
86+
textWithMarkupMatcher(/profile_lifecycle="trace",/)
87+
);
88+
expect(lifecycleMatches.length).toBeGreaterThan(0);
89+
lifecycleMatches.forEach(match => expect(match).toBeInTheDocument());
8490
});
8591
});

static/app/gettingStartedDocs/python/bottle.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ 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_session_sample_rate to 1.0 to profile 100%
50+
# of profile sessions.
51+
profile_session_sample_rate=1.0,
52+
# Set profile_lifecycle to "trace" to automatically
53+
# run the profiler on when there is an active transaction
54+
profile_lifecycle="trace",`
5555
: ''
5656
}
5757
)
@@ -76,7 +76,7 @@ const onboarding: OnboardingConfig = {
7676
description:
7777
params.docsLocation === DocsPageLocation.PROFILING_PAGE
7878
? tct(
79-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
79+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
8080
{
8181
code: <code />,
8282
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ 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(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
5050
).not.toBeInTheDocument();
5151
expect(
52-
screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
52+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
5353
).not.toBeInTheDocument();
5454

5555
// Does render transaction profiling config
@@ -78,10 +78,10 @@ describe('celery onboarding docs', function () {
7878

7979
// Does render continuous profiling config
8080
expect(
81-
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
81+
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
8282
).toBeInTheDocument();
8383
expect(
84-
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
84+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
8585
).toBeInTheDocument();
8686
});
8787
});

static/app/gettingStartedDocs/python/celery.tsx

+13-17
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,19 @@ sentry_sdk.init(
4343
# of sampled transactions.
4444
# We recommend adjusting this value in production.
4545
profiles_sample_rate=1.0,`
46-
: ''
46+
: params.isProfilingSelected &&
47+
params.profilingOptions?.defaultProfilingMode === 'continuous'
48+
? `
49+
# Set profile_session_sample_rate to 1.0 to profile 100%
50+
# of profile sessions.
51+
profile_session_sample_rate=1.0,
52+
# Set profile_lifecycle to "trace" to automatically
53+
# run the profiler on when there is an active transaction
54+
profile_lifecycle="trace",`
55+
: ''
4756
}
48-
)${
49-
params.isProfilingSelected &&
50-
params.profilingOptions?.defaultProfilingMode === 'continuous'
51-
? `
52-
53-
# Manually call start_profiler and stop_profiler
54-
# to profile the code in between
55-
sentry_sdk.profiler.start_profiler()
56-
# this code will be profiled
57-
#
58-
# Calls to stop_profiler are optional - if you don't stop the profiler, it will keep profiling
59-
# your application until the process exits or stop_profiler is called.
60-
sentry_sdk.profiler.stop_profiler()`
61-
: ''
62-
}`;
57+
)
58+
`;
6359

6460
const onboarding: OnboardingConfig = {
6561
introduction: () =>
@@ -80,7 +76,7 @@ const onboarding: OnboardingConfig = {
8076
description:
8177
params.docsLocation === DocsPageLocation.PROFILING_PAGE
8278
? tct(
83-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
79+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
8480
{
8581
code: <code />,
8682
}

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ describe('chalice 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_session_sample_rate=1\.0,/))
48+
).not.toBeInTheDocument();
49+
expect(
50+
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
5051
).not.toBeInTheDocument();
5152

5253
// Does render transaction profiling config
@@ -75,7 +76,10 @@ describe('chalice onboarding docs', function () {
7576

7677
// Does render continuous profiling config
7778
expect(
78-
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
79+
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
80+
).toBeInTheDocument();
81+
expect(
82+
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
7983
).toBeInTheDocument();
8084
});
8185
});

static/app/gettingStartedDocs/python/chalice.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ sentry_sdk.init(
4444
: params.isProfilingSelected &&
4545
params.profilingOptions?.defaultProfilingMode === 'continuous'
4646
? `
47-
_experiments={
48-
# Set continuous_profiling_auto_start to True
49-
# to automatically start the profiler on when
50-
# possible.
51-
"continuous_profiling_auto_start": True,
52-
},`
47+
# Set profile_session_sample_rate to 1.0 to profile 100%
48+
# of profile sessions.
49+
profile_session_sample_rate=1.0,
50+
# Set profile_lifecycle to "trace" to automatically
51+
# run the profiler on when there is an active transaction
52+
profile_lifecycle="trace",`
5353
: ''
5454
}
5555
)
@@ -81,7 +81,7 @@ const onboarding: OnboardingConfig = {
8181
description:
8282
params.docsLocation === DocsPageLocation.PROFILING_PAGE
8383
? tct(
84-
'You need a minimum version [code:1.18.0] of the [code:sentry-python] SDK for the profiling feature.',
84+
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
8585
{
8686
code: <code />,
8787
}

0 commit comments

Comments
 (0)