diff --git a/dev-packages/browser-integration-tests/utils/generatePlugin.ts b/dev-packages/browser-integration-tests/utils/generatePlugin.ts index b9b4dcb4c1f3..859dcc904f3f 100644 --- a/dev-packages/browser-integration-tests/utils/generatePlugin.ts +++ b/dev-packages/browser-integration-tests/utils/generatePlugin.ts @@ -30,12 +30,10 @@ const useLoader = bundleKey.startsWith('loader'); const IMPORTED_INTEGRATION_CDN_BUNDLE_PATHS: Record = { httpClientIntegration: 'httpclient', captureConsoleIntegration: 'captureconsole', - debugIntegration: 'debug', rewriteFramesIntegration: 'rewriteframes', contextLinesIntegration: 'contextlines', extraErrorDataIntegration: 'extraerrordata', reportingObserverIntegration: 'reportingobserver', - sessionTimingIntegration: 'sessiontiming', feedbackIntegration: 'feedback', moduleMetadataIntegration: 'modulemetadata', }; diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 15d51fde355c..f757e4898cc9 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -92,6 +92,11 @@ It will be removed in a future major version. ## 4. Removal of Deprecated APIs (TODO) +### `@sentry/core` / All SDKs + +- The `debugIntegration` has been removed. To log outgoing events, use [Hook Options](https://docs.sentry.io/platforms/javascript/configuration/options/#hooks) (`beforeSend`, `beforeSendTransaction`, ...). +- The `sessionTimingIntegration` has been removed. To capture session durations alongside events, use [Context](https://docs.sentry.io/platforms/javascript/enriching-events/context/) (`Sentry.setContext()`). + ### `@sentry/react` - The `wrapUseRoutes` method has been removed. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead depending on what version of react router you are using. diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 8557cfa4eb48..3fe0c0001715 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -34,8 +34,6 @@ export { createTransport, cron, dataloaderIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, defaultStackParser, @@ -105,8 +103,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, setContext, setCurrentClient, setExtra, diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 856d77d62be7..d486ba9f68a7 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -125,13 +125,9 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, } from '@sentry/core'; export { awsIntegration } from './integration/aws'; diff --git a/packages/browser/rollup.bundle.config.mjs b/packages/browser/rollup.bundle.config.mjs index f65c27aad6e9..e32c6817f578 100644 --- a/packages/browser/rollup.bundle.config.mjs +++ b/packages/browser/rollup.bundle.config.mjs @@ -10,7 +10,6 @@ const reexportedPluggableIntegrationFiles = [ 'dedupe', 'extraerrordata', 'rewriteframes', - 'sessiontiming', 'feedback', 'modulemetadata', ]; diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index e6f57c13fe6b..94e090692a4e 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -6,12 +6,8 @@ export { contextLinesIntegration } from './integrations/contextlines'; export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, captureFeedback, } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.debug.ts b/packages/browser/src/integrations-bundle/index.debug.ts index 7449888ce0ed..5539b5e36a6f 100644 --- a/packages/browser/src/integrations-bundle/index.debug.ts +++ b/packages/browser/src/integrations-bundle/index.debug.ts @@ -1,3 +1 @@ -// eslint-disable-next-line deprecation/deprecation -export { debugIntegration } from '@sentry/core'; export { spotlightBrowserIntegration } from '../integrations/spotlight'; diff --git a/packages/browser/src/integrations-bundle/index.sessiontiming.ts b/packages/browser/src/integrations-bundle/index.sessiontiming.ts deleted file mode 100644 index b601f2eb973b..000000000000 --- a/packages/browser/src/integrations-bundle/index.sessiontiming.ts +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line deprecation/deprecation -export { sessionTimingIntegration } from '@sentry/core'; diff --git a/packages/browser/src/utils/lazyLoadIntegration.ts b/packages/browser/src/utils/lazyLoadIntegration.ts index 768431316cdd..6e1a6450fc1e 100644 --- a/packages/browser/src/utils/lazyLoadIntegration.ts +++ b/packages/browser/src/utils/lazyLoadIntegration.ts @@ -13,13 +13,11 @@ const LazyLoadableIntegrations = { captureConsoleIntegration: 'captureconsole', contextLinesIntegration: 'contextlines', linkedErrorsIntegration: 'linkederrors', - debugIntegration: 'debug', dedupeIntegration: 'dedupe', extraErrorDataIntegration: 'extraerrordata', httpClientIntegration: 'httpclient', reportingObserverIntegration: 'reportingobserver', rewriteFramesIntegration: 'rewriteframes', - sessionTimingIntegration: 'sessiontiming', browserProfilingIntegration: 'browserprofiling', moduleMetadataIntegration: 'modulemetadata', } as const; diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index 96190169169e..94c40505ff41 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -147,13 +147,9 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, } from '@sentry/core'; export type { BunOptions } from './types'; diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index fb8c34694282..38f0565e61c3 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -74,8 +74,6 @@ export { linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 3681b0b7ccee..d7c4785cc3e2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -96,13 +96,9 @@ export { linkedErrorsIntegration } from './integrations/linkederrors'; export { moduleMetadataIntegration } from './integrations/metadata'; export { requestDataIntegration } from './integrations/requestdata'; export { captureConsoleIntegration } from './integrations/captureconsole'; -// eslint-disable-next-line deprecation/deprecation -export { debugIntegration } from './integrations/debug'; export { dedupeIntegration } from './integrations/dedupe'; export { extraErrorDataIntegration } from './integrations/extraerrordata'; export { rewriteFramesIntegration } from './integrations/rewriteframes'; -// eslint-disable-next-line deprecation/deprecation -export { sessionTimingIntegration } from './integrations/sessiontiming'; export { zodErrorsIntegration } from './integrations/zoderrors'; export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter'; // eslint-disable-next-line deprecation/deprecation diff --git a/packages/core/src/integrations/debug.ts b/packages/core/src/integrations/debug.ts deleted file mode 100644 index 66c70571365a..000000000000 --- a/packages/core/src/integrations/debug.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { defineIntegration } from '../integration'; -import type { Event, EventHint, IntegrationFn } from '../types-hoist'; -import { consoleSandbox } from '../utils-hoist/logger'; - -const INTEGRATION_NAME = 'Debug'; - -interface DebugOptions { - /** Controls whether console output created by this integration should be stringified. Default: `false` */ - stringify?: boolean; - /** Controls whether a debugger should be launched before an event is sent. Default: `false` */ - debugger?: boolean; -} - -const _debugIntegration = ((options: DebugOptions = {}) => { - const _options = { - debugger: false, - stringify: false, - ...options, - }; - - return { - name: INTEGRATION_NAME, - setup(client) { - client.on('beforeSendEvent', (event: Event, hint?: EventHint) => { - if (_options.debugger) { - // eslint-disable-next-line no-debugger - debugger; - } - - /* eslint-disable no-console */ - consoleSandbox(() => { - if (_options.stringify) { - console.log(JSON.stringify(event, null, 2)); - if (hint && Object.keys(hint).length) { - console.log(JSON.stringify(hint, null, 2)); - } - } else { - console.log(event); - if (hint && Object.keys(hint).length) { - console.log(hint); - } - } - }); - /* eslint-enable no-console */ - }); - }, - }; -}) satisfies IntegrationFn; - -/** - * Integration to debug sent Sentry events. - * This integration should not be used in production. - * - * @deprecated This integration is deprecated and will be removed in the next major version of the SDK. - * To log outgoing events, use [Hook Options](https://docs.sentry.io/platforms/javascript/configuration/options/#hooks) (`beforeSend`, `beforeSendTransaction`, ...). - */ -export const debugIntegration = defineIntegration(_debugIntegration); diff --git a/packages/core/src/integrations/sessiontiming.ts b/packages/core/src/integrations/sessiontiming.ts deleted file mode 100644 index a7112c4f939c..000000000000 --- a/packages/core/src/integrations/sessiontiming.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { defineIntegration } from '../integration'; -import type { IntegrationFn } from '../types-hoist'; -import { timestampInSeconds } from '../utils-hoist/time'; - -const INTEGRATION_NAME = 'SessionTiming'; - -const _sessionTimingIntegration = (() => { - const startTime = timestampInSeconds() * 1000; - - return { - name: INTEGRATION_NAME, - processEvent(event) { - const now = timestampInSeconds() * 1000; - - return { - ...event, - extra: { - ...event.extra, - ['session:start']: startTime, - ['session:duration']: now - startTime, - ['session:end']: now, - }, - }; - }, - }; -}) satisfies IntegrationFn; - -/** - * This function adds duration since the sessionTimingIntegration was initialized - * till the time event was sent. - * - * @deprecated This integration is deprecated and will be removed in the next major version of the SDK. - * To capture session durations alongside events, use [Context](https://docs.sentry.io/platforms/javascript/enriching-events/context/) (`Sentry.setContext()`). - */ -export const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration); diff --git a/packages/core/test/lib/integrations/debug.test.ts b/packages/core/test/lib/integrations/debug.test.ts deleted file mode 100644 index 00a938a185e6..000000000000 --- a/packages/core/test/lib/integrations/debug.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -import type { Client, Event, EventHint } from '../../../src/types-hoist'; - -import { debugIntegration } from '../../../src/integrations/debug'; - -function testEventLogged( - // eslint-disable-next-line deprecation/deprecation - integration: ReturnType, - testEvent?: Event, - testEventHint?: EventHint, -) { - const callbacks: ((event: Event, hint?: EventHint) => void)[] = []; - - const client: Client = { - on(hook: string, callback: (event: Event, hint?: EventHint) => void) { - expect(hook).toEqual('beforeSendEvent'); - callbacks.push(callback); - }, - } as Client; - - integration.setup?.(client); - - expect(callbacks.length).toEqual(1); - - if (testEvent) { - callbacks[0]?.(testEvent, testEventHint); - } -} - -// Replace console log with a mock so we can check for invocations -const mockConsoleLog = jest.fn(); -// eslint-disable-next-line @typescript-eslint/unbound-method -const originalConsoleLog = global.console.log; -global.console.log = mockConsoleLog; - -describe('Debug integration setup should register an event processor that', () => { - afterAll(() => { - // Reset mocked console log to original one - global.console.log = originalConsoleLog; - }); - - afterEach(() => { - jest.clearAllMocks(); - }); - - it('logs an event', () => { - // eslint-disable-next-line deprecation/deprecation - const debug = debugIntegration(); - const testEvent = { event_id: 'some event' }; - - testEventLogged(debug, testEvent); - - expect(mockConsoleLog).toHaveBeenCalledTimes(1); - expect(mockConsoleLog).toBeCalledWith(testEvent); - }); - - it('logs an event hint if available', () => { - // eslint-disable-next-line deprecation/deprecation - const debug = debugIntegration(); - - const testEvent = { event_id: 'some event' }; - const testEventHint = { event_id: 'some event hint' }; - - testEventLogged(debug, testEvent, testEventHint); - - expect(mockConsoleLog).toHaveBeenCalledTimes(2); - expect(mockConsoleLog).toBeCalledWith(testEvent); - expect(mockConsoleLog).toBeCalledWith(testEventHint); - }); - - it('logs events in stringified format when `stringify` option was set', () => { - // eslint-disable-next-line deprecation/deprecation - const debug = debugIntegration({ stringify: true }); - const testEvent = { event_id: 'some event' }; - - testEventLogged(debug, testEvent); - - expect(mockConsoleLog).toHaveBeenCalledTimes(1); - expect(mockConsoleLog).toBeCalledWith(JSON.stringify(testEvent, null, 2)); - }); - - it('logs event hints in stringified format when `stringify` option was set', () => { - // eslint-disable-next-line deprecation/deprecation - const debug = debugIntegration({ stringify: true }); - - const testEvent = { event_id: 'some event' }; - const testEventHint = { event_id: 'some event hint' }; - - testEventLogged(debug, testEvent, testEventHint); - - expect(mockConsoleLog).toHaveBeenCalledTimes(2); - expect(mockConsoleLog).toBeCalledWith(JSON.stringify(testEventHint, null, 2)); - }); -}); diff --git a/packages/core/test/lib/integrations/sessiontiming.test.ts b/packages/core/test/lib/integrations/sessiontiming.test.ts deleted file mode 100644 index fb694fe8be0f..000000000000 --- a/packages/core/test/lib/integrations/sessiontiming.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { sessionTimingIntegration } from '../../../src/integrations/sessiontiming'; -import type { Event } from '../../../src/types-hoist'; - -// eslint-disable-next-line deprecation/deprecation -const sessionTiming = sessionTimingIntegration(); - -describe('SessionTiming', () => { - it('should work as expected', () => { - const event = sessionTiming.processEvent?.( - { - extra: { - some: 'value', - }, - }, - {}, - {} as any, - ) as Event; - - expect(typeof event.extra?.['session:start']).toBe('number'); - expect(typeof event.extra?.['session:duration']).toBe('number'); - expect(typeof event.extra?.['session:end']).toBe('number'); - expect(event.extra?.some).toEqual('value'); - }); -}); diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index cea4effad4bd..72938e767b33 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -71,13 +71,9 @@ export { functionToStringIntegration, requestDataIntegration, captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index 8f7fdcfb24d0..24c1f137c5c7 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -125,13 +125,9 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, } from '@sentry/core'; export { getDefaultIntegrations, init } from './sdk'; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 82c7e94c7e2e..66fa8cd27e4a 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -114,14 +114,10 @@ export { captureMessage, captureFeedback, captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, - // eslint-disable-next-line deprecation/deprecation metricsDefault as metrics, startSession, captureSession, diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index 5a935bd1d4d7..7c4d1460edd6 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -37,8 +37,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, defaultStackParser, @@ -103,8 +101,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, setContext, setCurrentClient, setExtra, diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index 66aa39a37eae..6c7c4426e22d 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -29,8 +29,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, defaultStackParser, @@ -95,8 +93,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, setContext, setCurrentClient, setExtra, diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 44a362deddce..3e02465ce250 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -29,8 +29,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, defaultStackParser, @@ -97,8 +95,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation - sessionTimingIntegration, setContext, setCurrentClient, setExtra, diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index d6e6fc046837..2301d620bb05 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -74,8 +74,6 @@ export { linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, - // eslint-disable-next-line deprecation/deprecation - debugIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration,