Skip to content

Commit

Permalink
feat!: Remove autoSessionTracking option
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Dec 19, 2024
1 parent 87dcdef commit 8199f31
Show file tree
Hide file tree
Showing 32 changed files with 4 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
integrations: [captureConsoleIntegration()],
autoSessionTracking: false,
attachStacktrace: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
integrations: [captureConsoleIntegration()],
autoSessionTracking: false,
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '0.1',
// intentionally disabling this, we want to leverage the deprecated hub API
autoSessionTracking: false,
});

// simulate old startSessionTracking behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ setTimeout(() => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100, maxAnrEvents: 2 })],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
autoSessionTracking: true,
});

Sentry.setUser({ email: '[email protected]' });
Expand Down
1 change: 0 additions & 1 deletion dev-packages/node-integration-tests/suites/anr/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ setTimeout(() => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});

Expand Down
1 change: 0 additions & 1 deletion dev-packages/node-integration-tests/suites/anr/basic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ setTimeout(() => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});

Expand Down
1 change: 0 additions & 1 deletion dev-packages/node-integration-tests/suites/anr/forked.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ setTimeout(() => {
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
debug: true,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ setTimeout(() => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ setTimeout(() => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function configureSentry() {
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
debug: true,
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function configureSentry() {
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
debug: true,
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
debug: true,
autoSessionTracking: false,
integrations: [anr],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests');
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('ContextLines integration in CJS', () => {
'Sentry.init({',
" dsn: 'https://[email protected]/1337',",
" release: '1.0',",
' autoSessionTracking: false,',
' transport: loggingTransport,',
'});',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { CronJob } from 'cron';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as cron from 'node-cron';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as schedule from 'node-schedule';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ new iitm.Hook((_, name) => {
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
autoSessionTracking: false,
integrations: [Sentry.modulesIntegration()],
transport: loggingTransport,
});
10 changes: 2 additions & 8 deletions packages/angular/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,16 @@ export function getDefaultIntegrations(options: BrowserOptions = {}): Integratio
// see:
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
// - https://github.com/getsentry/sentry-javascript/issues/2744
const integrations = [
return [
inboundFiltersIntegration(),
functionToStringIntegration(),
breadcrumbsIntegration(),
globalHandlersIntegration(),
linkedErrorsIntegration(),
dedupeIntegration(),
httpContextIntegration(),
browserSessionIntegration(),
];

// eslint-disable-next-line deprecation/deprecation
if (options.autoSessionTracking !== false) {
integrations.push(browserSessionIntegration());
}

return integrations;
}

/**
Expand Down
11 changes: 2 additions & 9 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function getDefaultIntegrations(options: Options): Integration[] {
* Note: Please make sure this stays in sync with Angular SDK, which re-exports
* `getDefaultIntegrations` but with an adjusted set of integrations.
*/
const integrations = [
return [
inboundFiltersIntegration(),
functionToStringIntegration(),
browserApiErrorsIntegration(),
Expand All @@ -42,14 +42,8 @@ export function getDefaultIntegrations(options: Options): Integration[] {
linkedErrorsIntegration(),
dedupeIntegration(),
httpContextIntegration(),
browserSessionIntegration(),
];

// eslint-disable-next-line deprecation/deprecation
if (options.autoSessionTracking !== false) {
integrations.push(browserSessionIntegration());
}

return integrations;
}

function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
Expand All @@ -61,7 +55,6 @@ function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
: WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id // This supports the variable that sentry-webpack-plugin injects
? WINDOW.SENTRY_RELEASE.id
: undefined,
autoSessionTracking: true,
sendClientReports: true,
};

Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/types-hoist/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
/** Attaches stacktraces to pure capture message / log integrations */
attachStacktrace?: boolean;

/**
* A flag enabling Sessions Tracking feature.
* By default, Session Tracking is enabled.
*
* @deprecated Setting the `autoSessionTracking` option is deprecated.
* 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.
* 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`.
*/
autoSessionTracking?: boolean;

/**
* Send SDK Client Reports. When calling `Sentry.init()`, this option defaults to `true`.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/feedback/src/core/mockSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export async function mockSdk({ sentryOptions }: MockSdkParams = {}): Promise<vo
init({
...getDefaultClientOptions(),
dsn: 'https://[email protected]/1',
autoSessionTracking: false,
sendClientReports: false,
transport: () => new MockTransport(),
replaysSessionSampleRate: 0.0,
Expand Down
2 changes: 0 additions & 2 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ export function init(options: NodeOptions): NodeClient | undefined {
environment: process.env.SENTRY_ENVIRONMENT || getVercelEnv(false) || process.env.NODE_ENV,
defaultIntegrations: customDefaultIntegrations,
...options,
// Right now we only capture frontend sessions for Next.js
autoSessionTracking: false,
};

if (DEBUG_BUILD && opts.debug) {
Expand Down
1 change: 0 additions & 1 deletion packages/nextjs/test/serverSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('Server init()', () => {
],
},
},
autoSessionTracking: false,
environment: 'test',

// Integrations are tested separately, and we can't be more specific here without depending on the order in
Expand Down
10 changes: 0 additions & 10 deletions packages/node/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,6 @@ function getClientOptions(
): NodeClientOptions {
const release = getRelease(options.release);

const autoSessionTracking =
typeof release !== 'string'
? false
: // eslint-disable-next-line deprecation/deprecation
options.autoSessionTracking === undefined
? true
: // eslint-disable-next-line deprecation/deprecation
options.autoSessionTracking;

if (options.spotlight == null) {
const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });
if (spotlightEnv == null) {
Expand All @@ -240,7 +231,6 @@ function getClientOptions(

const overwriteOptions = dropUndefinedKeys({
release,
autoSessionTracking,
tracesSampleRate,
});

Expand Down
2 changes: 0 additions & 2 deletions packages/remix/test/integration/instrument.server.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ Sentry.init({
dsn: 'https://[email protected]/1337',
tracesSampleRate: 1,
tracePropagationTargets: ['example.org'],
// Disabling to test series of envelopes deterministically.
autoSessionTracking: false,
autoInstrumentRemix: process.env.USE_OTEL === '1',
});
1 change: 0 additions & 1 deletion packages/replay-internal/test/mocks/mockSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export async function mockSdk({ replayOptions, sentryOptions, autoStart = true }
const client = init({
...getDefaultClientOptions(),
dsn: 'https://[email protected]/1',
autoSessionTracking: false,
sendClientReports: false,
transport: () => new MockTransport(),
replaysSessionSampleRate: 1.0,
Expand Down
10 changes: 0 additions & 10 deletions packages/vercel-edge/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,12 @@ export function init(options: VercelEdgeOptions = {}): Client | undefined {
const detectedRelease = getSentryRelease();
if (detectedRelease !== undefined) {
options.release = detectedRelease;
} else {
// If release is not provided, then we should disable autoSessionTracking
// eslint-disable-next-line deprecation/deprecation
options.autoSessionTracking = false;
}
}

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

// eslint-disable-next-line deprecation/deprecation
if (options.autoSessionTracking === undefined && options.dsn !== undefined) {
// eslint-disable-next-line deprecation/deprecation
options.autoSessionTracking = true;
}

const client = new VercelEdgeClient({
...options,
stackParser: stackParserFromStackParserOptions(options.stackParser || nodeStackParser),
Expand Down
2 changes: 0 additions & 2 deletions packages/vue/test/integration/VueIntegration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('Sentry.VueIntegration', () => {
Sentry.init({
dsn: PUBLIC_DSN,
defaultIntegrations: false,
autoSessionTracking: false,
});

const el = document.createElement('div');
Expand All @@ -78,7 +77,6 @@ describe('Sentry.VueIntegration', () => {
Sentry.init({
dsn: PUBLIC_DSN,
defaultIntegrations: false,
autoSessionTracking: false,
});

const el = document.createElement('div');
Expand Down

0 comments on commit 8199f31

Please sign in to comment.