Skip to content

chore(profiling): Update python profiling docs for new SDK #85560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
28 changes: 14 additions & 14 deletions static/app/gettingStartedDocs/python/aiohttp.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@ describe('aiohttp onboarding docs', function () {

// Does not render continuous profiling config
expect(
screen.queryByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
)
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();
expect(
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).not.toBeInTheDocument();

// Does render transaction profiling config
const matches = screen.getAllByText(
textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
);
expect(matches.length).toBeGreaterThan(0);
matches.forEach(match => expect(match).toBeInTheDocument());
expect(
screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
).toBeInTheDocument();
});

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

// Does not render transaction profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate: 1\.0,/))
).not.toBeInTheDocument();

// Does render continuous profiling config
const matches = screen.getAllByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
);
expect(matches.length).toBeGreaterThan(0);
matches.forEach(match => expect(match).toBeInTheDocument());
expect(
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).toBeInTheDocument();
});
});
12 changes: 6 additions & 6 deletions static/app/gettingStartedDocs/python/aiohttp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ sentry_sdk.init(
: params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `
_experiments={
# Set continuous_profiling_auto_start to True
# to automatically start the profiler when
# possible.
"continuous_profiling_auto_start": True,
},`
# Set profile_session_sample_rate to 1.0 to profile 100%
# of profile sessions.
profile_session_sample_rate=1.0,
# Set profile_lifecycle to "trace" to automatically
# run the profiler on when there is an active transaction
profile_lifecycle="trace",`
: ''
}
)
Expand Down
18 changes: 11 additions & 7 deletions static/app/gettingStartedDocs/python/asgi.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('asgi onboarding docs', function () {

// Does not render config option
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does not render config option
Expand All @@ -42,14 +42,15 @@ describe('asgi onboarding docs', function () {

// Does not render continuous profiling config
expect(
screen.queryByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
)
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();
expect(
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).not.toBeInTheDocument();

// Does render transaction profiling config
expect(
screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
});

Expand All @@ -68,12 +69,15 @@ describe('asgi onboarding docs', function () {

// Does not render transaction profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does render continuous profiling config
expect(
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).toBeInTheDocument();
});
});
16 changes: 8 additions & 8 deletions static/app/gettingStartedDocs/python/asgi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ sentry_sdk.init(
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode !== 'continuous'
? `
# Set profiles_sample_rate to 1.0 to profile 100%
# Set profile_session_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,`
profile_session_sample_rate=1.0,`
: params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `
_experiments={
# Set continuous_profiling_auto_start to True
# to automatically start the profiler on when
# possible.
"continuous_profiling_auto_start": True,
},`
# Set profile_session_sample_rate to 1.0 to profile 100%
# of profile sessions.
profile_session_sample_rate=1.0,
# Set profile_lifecycle to "trace" to automatically
# run the profiler on when there is an active transaction
profile_lifecycle="trace",`
: ''
}
)
Expand Down
18 changes: 11 additions & 7 deletions static/app/gettingStartedDocs/python/awslambda.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('awslambda onboarding docs', function () {

// Does not render config option
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does not render config option
Expand All @@ -42,14 +42,15 @@ describe('awslambda onboarding docs', function () {

// Does not render continuous profiling config
expect(
screen.queryByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
)
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();
expect(
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).not.toBeInTheDocument();

// Does render transaction profiling config
expect(
screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
});

Expand All @@ -68,12 +69,15 @@ describe('awslambda onboarding docs', function () {

// Does not render transaction profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does render continuous profiling config
expect(
screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).toBeInTheDocument();
});
});
16 changes: 8 additions & 8 deletions static/app/gettingStartedDocs/python/awslambda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ sentry_sdk.init(
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode !== 'continuous'
? `
# Set profiles_sample_rate to 1.0 to profile 100%
# Set profile_session_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,`
profile_session_sample_rate=1.0,`
: params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `
_experiments={
# Set continuous_profiling_auto_start to True
# to automatically start the profiler on when
# possible.
"continuous_profiling_auto_start": True,
},`
# Set profile_session_sample_rate to 1.0 to profile 100%
# of profile sessions.
profile_session_sample_rate=1.0,
# Set profile_lifecycle to "trace" to automatically
# run the profiler on when there is an active transaction
profile_lifecycle="trace",`
: ''
}
)
Expand Down
26 changes: 16 additions & 10 deletions static/app/gettingStartedDocs/python/bottle.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('bottle onboarding docs', function () {

// Does not render config option
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does not render config option
Expand All @@ -44,14 +44,15 @@ describe('bottle onboarding docs', function () {

// Does not render continuous profiling config
expect(
screen.queryByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
)
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();
expect(
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).not.toBeInTheDocument();

// Does render transaction profiling config
const matches = screen.getAllByText(
textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/)
);
expect(matches.length).toBeGreaterThan(0);
matches.forEach(match => expect(match).toBeInTheDocument());
Expand All @@ -72,14 +73,19 @@ describe('bottle onboarding docs', function () {

// Does not render transaction profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate: 1\.0,/))
).not.toBeInTheDocument();

// Does render continuous profiling config
const matches = screen.getAllByText(
textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
const sampleRateMatches = screen.getAllByText(
textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/)
);
expect(matches.length).toBeGreaterThan(0);
matches.forEach(match => expect(match).toBeInTheDocument());
expect(sampleRateMatches.length).toBeGreaterThan(0);
sampleRateMatches.forEach(match => expect(match).toBeInTheDocument());
const lifeCycleMatches = screen.getAllByText(
textWithMarkupMatcher(/profile_lifecycle="trace",/)
);
expect(lifeCycleMatches.length).toBeGreaterThan(0);
lifeCycleMatches.forEach(match => expect(match).toBeInTheDocument());
});
});
16 changes: 8 additions & 8 deletions static/app/gettingStartedDocs/python/bottle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ sentry_sdk.init(
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode !== 'continuous'
? `
# Set profiles_sample_rate to 1.0 to profile 100%
# Set profile_session_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,`
profile_session_sample_rate=1.0,`
: params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `
_experiments={
# Set continuous_profiling_auto_start to True
# to automatically start the profiler on when
# possible.
"continuous_profiling_auto_start": True,
},`
# Set profile_session_sample_rate to 1.0 to profile 100%
# of profile sessions.
profile_session_sample_rate=1.0,
# Set profile_lifecycle to "trace" to automatically
# run the profiler on when there is an active transaction
profile_lifecycle="trace",`
: ''
}
)
Expand Down
14 changes: 7 additions & 7 deletions static/app/gettingStartedDocs/python/celery.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('celery onboarding docs', function () {

// Does not render config option
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does not render config option
Expand All @@ -46,15 +46,15 @@ describe('celery onboarding docs', function () {

// Does not render continuous profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();
expect(
screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
screen.queryByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).not.toBeInTheDocument();

// Does render transaction profiling config
expect(
screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
});

Expand All @@ -73,15 +73,15 @@ describe('celery onboarding docs', function () {

// Does not render transaction profiling config
expect(
screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
screen.queryByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).not.toBeInTheDocument();

// Does render continuous profiling config
expect(
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
screen.getByText(textWithMarkupMatcher(/profile_session_sample_rate=1\.0,/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
screen.getByText(textWithMarkupMatcher(/profile_lifecycle="trace",/))
).toBeInTheDocument();
});
});
30 changes: 13 additions & 17 deletions static/app/gettingStartedDocs/python/celery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,23 @@ sentry_sdk.init(
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode !== 'continuous'
? `
# Set profiles_sample_rate to 1.0 to profile 100%
# Set profile_session_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,`
: ''
: params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `
# Set profile_session_sample_rate to 1.0 to profile 100%
# of profile sessions.
profile_session_sample_rate=1.0,
# Set profile_lifecycle to "trace" to automatically
# run the profiler on when there is an active transaction
profile_lifecycle="trace",`
: ''
}
)${
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
? `

# Manually call start_profiler and stop_profiler
# to profile the code in between
sentry_sdk.profiler.start_profiler()
# this code will be profiled
#
# Calls to stop_profiler are optional - if you don't stop the profiler, it will keep profiling
# your application until the process exits or stop_profiler is called.
sentry_sdk.profiler.stop_profiler()`
: ''
}`;
)
`;

const onboarding: OnboardingConfig = {
introduction: () =>
Expand Down
Loading
Loading