Skip to content

profiling: update profiling onboarding to use new API #86986

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

Merged
merged 8 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/node/awslambda.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('awslambda onboarding docs', function () {
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand Down Expand Up @@ -70,7 +70,7 @@ describe('awslambda onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -97,7 +97,7 @@ describe('awslambda onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
10 changes: 5 additions & 5 deletions static/app/gettingStartedDocs/node/azurefunctions.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ describe('express onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
).toBeInTheDocument();
});

it('enables performance setting the tracesSampleRate to 1', () => {
Expand Down Expand Up @@ -69,7 +66,10 @@ describe('express onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand All @@ -96,7 +96,7 @@ describe('express onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/node/connect.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('connect onboarding docs', function () {
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand Down Expand Up @@ -77,7 +77,7 @@ describe('connect onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -104,7 +104,7 @@ describe('connect onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
10 changes: 5 additions & 5 deletions static/app/gettingStartedDocs/node/express.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ describe('express onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
).toBeInTheDocument();
});

it('enables performance setting the tracesSampleRate to 1', () => {
Expand All @@ -63,6 +60,9 @@ describe('express onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

it('enables profiling by setting profiling samplerates', () => {
Expand All @@ -78,7 +78,7 @@ describe('express onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});
it('continuous profiling', () => {
Expand All @@ -104,7 +104,7 @@ describe('express onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
10 changes: 5 additions & 5 deletions static/app/gettingStartedDocs/node/fastify.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ describe('fastify onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
).toBeInTheDocument();
});

it('enables performance setting the tracesSampleRate to 1', () => {
Expand All @@ -63,6 +60,9 @@ describe('fastify onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

it('enables profiling by setting profiling samplerates', () => {
Expand All @@ -78,7 +78,7 @@ describe('fastify onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -105,7 +105,7 @@ describe('fastify onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
10 changes: 5 additions & 5 deletions static/app/gettingStartedDocs/node/gcpfunctions.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ describe('gcpfunctions onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
).toBeInTheDocument();
});

it('enables performance setting the tracesSampleRate to 1', () => {
Expand All @@ -57,6 +54,9 @@ describe('gcpfunctions onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

it('enables profiling by setting profiling samplerates', () => {
Expand All @@ -72,7 +72,7 @@ describe('gcpfunctions onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -99,7 +99,7 @@ describe('gcpfunctions onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
10 changes: 5 additions & 5 deletions static/app/gettingStartedDocs/node/hapi.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ describe('hapi onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
).toBeInTheDocument();
});

it('enables performance setting the tracesSampleRate to 1', () => {
Expand All @@ -63,6 +60,9 @@ describe('hapi onboarding docs', function () {
expect(
screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

it('enables profiling by setting profiling samplerates', () => {
Expand All @@ -78,7 +78,7 @@ describe('hapi onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -105,7 +105,7 @@ describe('hapi onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/node/koa.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('koa onboarding docs', function () {
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('koa onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -105,7 +105,7 @@ describe('koa onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/node/nestjs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Nest.js onboarding docs', function () {
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Nest.js onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -105,7 +105,7 @@ describe('Nest.js onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/node/node.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('node onboarding docs', function () {
screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
screen.getByText(textWithMarkupMatcher(/profileSessionSampleRate: 1.0/))
).toBeInTheDocument();
});

Expand Down Expand Up @@ -70,7 +70,7 @@ describe('node onboarding docs', function () {
)
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).toBeInTheDocument();
});

Expand All @@ -97,7 +97,7 @@ describe('node onboarding docs', function () {

// Profiles sample rate should not be set for continuous profiling
expect(
screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/))
).not.toBeInTheDocument();

// Should have start and stop profiling calls
Expand Down
15 changes: 10 additions & 5 deletions static/app/utils/gettingStartedDocs/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ Sentry.init({
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode !== 'continuous'
? `
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,`
: ''
// Set sampling rate for profiling - this is evaluated only once per SDK.init call
profileSessionSampleRate: 1.0,
// Trace lifecycle automatically enables profiling during active traces
profileLifecycle: 'trace',`
: `
// Set sampling rate for profiling - this is evaluated only once per SDK.init
profileSessionSampleRate: 1.0,
`
}});${
params.isProfilingSelected &&
params.profilingOptions?.defaultProfilingMode === 'continuous'
Expand All @@ -241,8 +246,8 @@ Sentry.startSpan({
`
: '// this code will be profiled'
}
// Calls to stopProfiling are optional - if you don't stop the profiler, it will keep profiling
// your application until the process exits or stopProfiling is called.
// Calls to stopProfiler are optional - if you don't stop the profile session, it will keep profiling
// your application until the process exits or stopProfiler is called.
Sentry.profiler.stopProfiler();`
: ''
}`;
Expand Down
Loading