diff --git a/static/app/gettingStartedDocs/node/awslambda.spec.tsx b/static/app/gettingStartedDocs/node/awslambda.spec.tsx index e12988ba7b218d..2c6072f2cda6e5 100644 --- a/static/app/gettingStartedDocs/node/awslambda.spec.tsx +++ b/static/app/gettingStartedDocs/node/awslambda.spec.tsx @@ -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(); }); @@ -70,7 +70,7 @@ describe('awslambda onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/azurefunctions.spec.tsx b/static/app/gettingStartedDocs/node/azurefunctions.spec.tsx index 39bb9b2d626e7d..be3f1221496c7d 100644 --- a/static/app/gettingStartedDocs/node/azurefunctions.spec.tsx +++ b/static/app/gettingStartedDocs/node/azurefunctions.spec.tsx @@ -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', () => { @@ -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(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/connect.spec.tsx b/static/app/gettingStartedDocs/node/connect.spec.tsx index 2748cfd231ce35..fc36eef3e2267e 100644 --- a/static/app/gettingStartedDocs/node/connect.spec.tsx +++ b/static/app/gettingStartedDocs/node/connect.spec.tsx @@ -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(); }); @@ -77,7 +77,7 @@ describe('connect onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/express.spec.tsx b/static/app/gettingStartedDocs/node/express.spec.tsx index 1bf52c75c23fdf..462621fa2719c4 100644 --- a/static/app/gettingStartedDocs/node/express.spec.tsx +++ b/static/app/gettingStartedDocs/node/express.spec.tsx @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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 diff --git a/static/app/gettingStartedDocs/node/fastify.spec.tsx b/static/app/gettingStartedDocs/node/fastify.spec.tsx index 5e829e334aff3f..e029f0bcc55d0a 100644 --- a/static/app/gettingStartedDocs/node/fastify.spec.tsx +++ b/static/app/gettingStartedDocs/node/fastify.spec.tsx @@ -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', () => { @@ -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', () => { @@ -78,7 +78,7 @@ describe('fastify onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/gcpfunctions.spec.tsx b/static/app/gettingStartedDocs/node/gcpfunctions.spec.tsx index f0df91ca70c987..b3171f418c0f1c 100644 --- a/static/app/gettingStartedDocs/node/gcpfunctions.spec.tsx +++ b/static/app/gettingStartedDocs/node/gcpfunctions.spec.tsx @@ -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', () => { @@ -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', () => { @@ -72,7 +72,7 @@ describe('gcpfunctions onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/hapi.spec.tsx b/static/app/gettingStartedDocs/node/hapi.spec.tsx index aaef22d5c187c3..21c5e87d3168c0 100644 --- a/static/app/gettingStartedDocs/node/hapi.spec.tsx +++ b/static/app/gettingStartedDocs/node/hapi.spec.tsx @@ -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', () => { @@ -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', () => { @@ -78,7 +78,7 @@ describe('hapi onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/koa.spec.tsx b/static/app/gettingStartedDocs/node/koa.spec.tsx index 63d5c4131a39b7..2e347f675deaf0 100644 --- a/static/app/gettingStartedDocs/node/koa.spec.tsx +++ b/static/app/gettingStartedDocs/node/koa.spec.tsx @@ -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(); }); @@ -78,7 +78,7 @@ describe('koa onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/nestjs.spec.tsx b/static/app/gettingStartedDocs/node/nestjs.spec.tsx index ec3b9257572787..89a3d12e674b24 100644 --- a/static/app/gettingStartedDocs/node/nestjs.spec.tsx +++ b/static/app/gettingStartedDocs/node/nestjs.spec.tsx @@ -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(); }); @@ -78,7 +78,7 @@ describe('Nest.js onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/gettingStartedDocs/node/node.spec.tsx b/static/app/gettingStartedDocs/node/node.spec.tsx index b50066153bc417..1094eaf5b23950 100644 --- a/static/app/gettingStartedDocs/node/node.spec.tsx +++ b/static/app/gettingStartedDocs/node/node.spec.tsx @@ -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(); }); @@ -70,7 +70,7 @@ describe('node onboarding docs', function () { ) ).toBeInTheDocument(); expect( - screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/)) + screen.getByText(textWithMarkupMatcher(/profileLifecycle: 'trace'/)) ).toBeInTheDocument(); }); @@ -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 diff --git a/static/app/utils/gettingStartedDocs/node.ts b/static/app/utils/gettingStartedDocs/node.ts index 1eebf7fb764de4..9043e481073ecc 100644 --- a/static/app/utils/gettingStartedDocs/node.ts +++ b/static/app/utils/gettingStartedDocs/node.ts @@ -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' @@ -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();` : '' }`;