Skip to content

Commit e8e84ea

Browse files
authored
feat!: Remove autoSessionTracking option (#14802)
Ref #14609
1 parent a3bbb52 commit e8e84ea

File tree

34 files changed

+8
-85
lines changed

34 files changed

+8
-85
lines changed

dev-packages/browser-integration-tests/suites/integrations/captureConsole-attachStackTrace/init.js

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ window.Sentry = Sentry;
66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
88
integrations: [captureConsoleIntegration()],
9-
autoSessionTracking: false,
109
attachStacktrace: true,
1110
});

dev-packages/browser-integration-tests/suites/integrations/captureConsole/init.js

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ window.Sentry = Sentry;
66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
88
integrations: [captureConsoleIntegration()],
9-
autoSessionTracking: false,
109
});

dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/init.js

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ window.Sentry = Sentry;
55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
77
release: '0.1',
8-
// intentionally disabling this, we want to leverage the deprecated hub API
9-
autoSessionTracking: false,
108
});
119

1210
// simulate old startSessionTracking behavior

dev-packages/node-integration-tests/suites/anr/app-path.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ setTimeout(() => {
1616
Sentry.init({
1717
dsn: process.env.SENTRY_DSN,
1818
release: '1.0',
19-
autoSessionTracking: false,
2019
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100, appRootPath: __dirname })],
2120
});
2221

dev-packages/node-integration-tests/suites/anr/basic-multiple.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ setTimeout(() => {
1212
Sentry.init({
1313
dsn: process.env.SENTRY_DSN,
1414
release: '1.0',
15-
autoSessionTracking: false,
1615
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100, maxAnrEvents: 2 })],
1716
});
1817

dev-packages/node-integration-tests/suites/anr/basic-session.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Sentry.init({
1111
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
1313
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
14-
autoSessionTracking: true,
1514
});
1615

1716
Sentry.setUser({ email: '[email protected]' });

dev-packages/node-integration-tests/suites/anr/basic.js

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ setTimeout(() => {
1212
Sentry.init({
1313
dsn: process.env.SENTRY_DSN,
1414
release: '1.0',
15-
autoSessionTracking: false,
1615
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1716
});
1817

dev-packages/node-integration-tests/suites/anr/basic.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ setTimeout(() => {
1212
Sentry.init({
1313
dsn: process.env.SENTRY_DSN,
1414
release: '1.0',
15-
autoSessionTracking: false,
1615
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1716
});
1817

dev-packages/node-integration-tests/suites/anr/forked.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ setTimeout(() => {
1010
Sentry.init({
1111
dsn: 'https://[email protected]/1337',
1212
release: '1.0',
13-
autoSessionTracking: false,
1413
debug: true,
1514
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1615
});

dev-packages/node-integration-tests/suites/anr/indefinite.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ setTimeout(() => {
1010
Sentry.init({
1111
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
autoSessionTracking: false,
1413
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1514
});
1615

dev-packages/node-integration-tests/suites/anr/isolated.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ setTimeout(() => {
1010
Sentry.init({
1111
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
autoSessionTracking: false,
1413
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1514
});
1615

dev-packages/node-integration-tests/suites/anr/should-exit-forced.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ function configureSentry() {
44
Sentry.init({
55
dsn: 'https://[email protected]/1337',
66
release: '1.0',
7-
autoSessionTracking: false,
87
debug: true,
98
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
109
});

dev-packages/node-integration-tests/suites/anr/should-exit.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ function configureSentry() {
44
Sentry.init({
55
dsn: 'https://[email protected]/1337',
66
release: '1.0',
7-
autoSessionTracking: false,
87
debug: true,
98
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
109
});

dev-packages/node-integration-tests/suites/anr/stop-and-start.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Sentry.init({
1313
dsn: 'https://[email protected]/1337',
1414
release: '1.0',
1515
debug: true,
16-
autoSessionTracking: false,
1716
integrations: [anr],
1817
});
1918

dev-packages/node-integration-tests/suites/contextLines/instrument.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ import * as Sentry from '@sentry/node';
44
Sentry.init({
55
dsn: 'https://[email protected]/1337',
66
release: '1.0',
7-
autoSessionTracking: false,
87
transport: loggingTransport,
98
});

dev-packages/node-integration-tests/suites/contextLines/scenario with space.cjs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests');
44
Sentry.init({
55
dsn: 'https://[email protected]/1337',
66
release: '1.0',
7-
autoSessionTracking: false,
87
transport: loggingTransport,
98
});
109

dev-packages/node-integration-tests/suites/contextLines/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ describe('ContextLines integration in CJS', () => {
5555
filename: expect.stringMatching(/\/scenario with space.cjs$/),
5656
context_line: "Sentry.captureException(new Error('Test Error'));",
5757
pre_context: [
58+
'',
5859
'Sentry.init({',
5960
" dsn: 'https://[email protected]/1337',",
6061
" release: '1.0',",
61-
' autoSessionTracking: false,',
6262
' transport: loggingTransport,',
6363
'});',
6464
'',
6565
],
6666
post_context: ['', '// some more post context'],
6767
colno: 25,
68-
lineno: 11,
68+
lineno: 10,
6969
function: 'Object.?',
7070
in_app: true,
7171
module: 'scenario with space',

dev-packages/node-integration-tests/suites/cron/cron/scenario.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { CronJob } from 'cron';
55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
8-
autoSessionTracking: false,
98
transport: loggingTransport,
109
});
1110

dev-packages/node-integration-tests/suites/cron/node-cron/scenario.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as cron from 'node-cron';
55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
8-
autoSessionTracking: false,
98
transport: loggingTransport,
109
});
1110

dev-packages/node-integration-tests/suites/cron/node-schedule/scenario.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as schedule from 'node-schedule';
55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
8-
autoSessionTracking: false,
98
transport: loggingTransport,
109
});
1110

dev-packages/node-integration-tests/suites/esm/import-in-the-middle/app.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ new iitm.Hook((_, name) => {
1111
Sentry.init({
1212
dsn: 'https://[email protected]/1337',
1313
release: '1.0',
14-
autoSessionTracking: false,
1514
transport: loggingTransport,
1615
registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true },
1716
});

dev-packages/node-integration-tests/suites/esm/modules-integration/app.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as Sentry from '@sentry/node';
44
Sentry.init({
55
dsn: 'https://[email protected]/1337',
66
release: '1.0',
7-
autoSessionTracking: false,
87
integrations: [Sentry.modulesIntegration()],
98
transport: loggingTransport,
109
});

packages/angular/src/sdk.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { IS_DEBUG_BUILD } from './flags';
2323
/**
2424
* Get the default integrations for the Angular SDK.
2525
*/
26-
export function getDefaultIntegrations(options: BrowserOptions = {}): Integration[] {
26+
export function getDefaultIntegrations(_options: BrowserOptions = {}): Integration[] {
2727
// Don't include the BrowserApiErrors integration as it interferes with the Angular SDK's `ErrorHandler`:
2828
// BrowserApiErrors would catch certain errors before they reach the `ErrorHandler` and
2929
// thus provide a lower fidelity error than what `SentryErrorHandler`
@@ -32,22 +32,16 @@ export function getDefaultIntegrations(options: BrowserOptions = {}): Integratio
3232
// see:
3333
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
3434
// - https://github.com/getsentry/sentry-javascript/issues/2744
35-
const integrations = [
35+
return [
3636
inboundFiltersIntegration(),
3737
functionToStringIntegration(),
3838
breadcrumbsIntegration(),
3939
globalHandlersIntegration(),
4040
linkedErrorsIntegration(),
4141
dedupeIntegration(),
4242
httpContextIntegration(),
43+
browserSessionIntegration(),
4344
];
44-
45-
// eslint-disable-next-line deprecation/deprecation
46-
if (options.autoSessionTracking !== false) {
47-
integrations.push(browserSessionIntegration());
48-
}
49-
50-
return integrations;
5145
}
5246

5347
/**

packages/browser/src/sdk.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import { defaultStackParser } from './stack-parsers';
2727
import { makeFetchTransport } from './transports/fetch';
2828

2929
/** Get the default integrations for the browser SDK. */
30-
export function getDefaultIntegrations(options: Options): Integration[] {
30+
export function getDefaultIntegrations(_options: Options): Integration[] {
3131
/**
3232
* Note: Please make sure this stays in sync with Angular SDK, which re-exports
3333
* `getDefaultIntegrations` but with an adjusted set of integrations.
3434
*/
35-
const integrations = [
35+
return [
3636
inboundFiltersIntegration(),
3737
functionToStringIntegration(),
3838
browserApiErrorsIntegration(),
@@ -41,14 +41,8 @@ export function getDefaultIntegrations(options: Options): Integration[] {
4141
linkedErrorsIntegration(),
4242
dedupeIntegration(),
4343
httpContextIntegration(),
44+
browserSessionIntegration(),
4445
];
45-
46-
// eslint-disable-next-line deprecation/deprecation
47-
if (options.autoSessionTracking !== false) {
48-
integrations.push(browserSessionIntegration());
49-
}
50-
51-
return integrations;
5246
}
5347

5448
/** Exported only for tests. */
@@ -61,7 +55,6 @@ export function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOpt
6155
: WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id // This supports the variable that sentry-webpack-plugin injects
6256
? WINDOW.SENTRY_RELEASE.id
6357
: undefined,
64-
autoSessionTracking: true,
6558
sendClientReports: true,
6659
};
6760

packages/browser/test/sdk.test.ts

-3
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ describe('applyDefaultOptions', () => {
286286
expect(actual).toEqual({
287287
defaultIntegrations: expect.any(Array),
288288
release: undefined,
289-
autoSessionTracking: true,
290289
sendClientReports: true,
291290
});
292291

@@ -299,14 +298,12 @@ describe('applyDefaultOptions', () => {
299298
const options = {
300299
tracesSampleRate: 0.5,
301300
release: '1.0.0',
302-
autoSessionTracking: false,
303301
};
304302
const actual = applyDefaultOptions(options);
305303

306304
expect(actual).toEqual({
307305
defaultIntegrations: expect.any(Array),
308306
release: '1.0.0',
309-
autoSessionTracking: false,
310307
sendClientReports: true,
311308
tracesSampleRate: 0.5,
312309
});

packages/core/src/types-hoist/options.ts

-10
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
2424
/** Attaches stacktraces to pure capture message / log integrations */
2525
attachStacktrace?: boolean;
2626

27-
/**
28-
* A flag enabling Sessions Tracking feature.
29-
* By default, Session Tracking is enabled.
30-
*
31-
* @deprecated Setting the `autoSessionTracking` option is deprecated.
32-
* To enable session tracking, it is recommended to unset `autoSessionTracking` and ensure that either, in browser environments the `browserSessionIntegration` is added, or in server environments the `httpIntegration` is added.
33-
* To disable session tracking, it is recommended unset `autoSessionTracking` and to remove the `browserSessionIntegration` in browser environments, or in server environments configure the `httpIntegration` with the `trackIncomingRequestsAsSessions` option set to `false`.
34-
*/
35-
autoSessionTracking?: boolean;
36-
3727
/**
3828
* Send SDK Client Reports. When calling `Sentry.init()`, this option defaults to `true`.
3929
*/

packages/feedback/src/core/mockSdk.ts

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export async function mockSdk({ sentryOptions }: MockSdkParams = {}): Promise<vo
4646
init({
4747
...getDefaultClientOptions(),
4848
dsn: 'https://[email protected]/1',
49-
autoSessionTracking: false,
5049
sendClientReports: false,
5150
transport: () => new MockTransport(),
5251
replaysSessionSampleRate: 0.0,

packages/nextjs/src/server/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ export function init(options: NodeOptions): NodeClient | undefined {
117117
environment: process.env.SENTRY_ENVIRONMENT || getVercelEnv(false) || process.env.NODE_ENV,
118118
defaultIntegrations: customDefaultIntegrations,
119119
...options,
120-
// Right now we only capture frontend sessions for Next.js
121-
autoSessionTracking: false,
122120
};
123121

124122
if (DEBUG_BUILD && opts.debug) {

packages/nextjs/test/serverSdk.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ describe('Server init()', () => {
4848
],
4949
},
5050
},
51-
autoSessionTracking: false,
5251
environment: 'test',
5352

5453
// Integrations are tested separately, and we can't be more specific here without depending on the order in

packages/node/src/sdk/index.ts

-10
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,6 @@ function getClientOptions(
213213
): NodeClientOptions {
214214
const release = getRelease(options.release);
215215

216-
const autoSessionTracking =
217-
typeof release !== 'string'
218-
? false
219-
: // eslint-disable-next-line deprecation/deprecation
220-
options.autoSessionTracking === undefined
221-
? true
222-
: // eslint-disable-next-line deprecation/deprecation
223-
options.autoSessionTracking;
224-
225216
if (options.spotlight == null) {
226217
const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });
227218
if (spotlightEnv == null) {
@@ -242,7 +233,6 @@ function getClientOptions(
242233

243234
const overwriteOptions = dropUndefinedKeys({
244235
release,
245-
autoSessionTracking,
246236
tracesSampleRate,
247237
});
248238

packages/remix/test/integration/instrument.server.cjs

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ Sentry.init({
44
dsn: 'https://[email protected]/1337',
55
tracesSampleRate: 1,
66
tracePropagationTargets: ['example.org'],
7-
// Disabling to test series of envelopes deterministically.
8-
autoSessionTracking: false,
97
autoInstrumentRemix: process.env.USE_OTEL === '1',
108
});

packages/replay-internal/test/mocks/mockSdk.ts

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export async function mockSdk({ replayOptions, sentryOptions, autoStart = true }
7575
const client = init({
7676
...getDefaultClientOptions(),
7777
dsn: 'https://[email protected]/1',
78-
autoSessionTracking: false,
7978
sendClientReports: false,
8079
transport: () => new MockTransport(),
8180
replaysSessionSampleRate: 1.0,

packages/vercel-edge/src/sdk.ts

-10
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,12 @@ export function init(options: VercelEdgeOptions = {}): Client | undefined {
8585
const detectedRelease = getSentryRelease();
8686
if (detectedRelease !== undefined) {
8787
options.release = detectedRelease;
88-
} else {
89-
// If release is not provided, then we should disable autoSessionTracking
90-
// eslint-disable-next-line deprecation/deprecation
91-
options.autoSessionTracking = false;
9288
}
9389
}
9490

9591
options.environment =
9692
options.environment || process.env.SENTRY_ENVIRONMENT || getVercelEnv(false) || process.env.NODE_ENV;
9793

98-
// eslint-disable-next-line deprecation/deprecation
99-
if (options.autoSessionTracking === undefined && options.dsn !== undefined) {
100-
// eslint-disable-next-line deprecation/deprecation
101-
options.autoSessionTracking = true;
102-
}
103-
10494
const client = new VercelEdgeClient({
10595
...options,
10696
stackParser: stackParserFromStackParserOptions(options.stackParser || nodeStackParser),

0 commit comments

Comments
 (0)