Skip to content

Commit 3399c4a

Browse files
authored
feat(v8/integrations): Remove deprecated exports (#10556)
- Remove class based exports - Delete `Transaction` integration
1 parent a9bd136 commit 3399c4a

File tree

30 files changed

+415
-658
lines changed

30 files changed

+415
-658
lines changed

.github/workflows/flaky-test-detector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
list-files: json
7878
filters: |
79-
browser_integration: dev-packages/browser-integration-tests/suites/**
79+
browser_integration: dev-packages/browser-integration-tests/suites/**/test.ts
8080
8181
- name: Detect flaky tests
8282
run: yarn test:detect-flaky

MIGRATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ to access and mutate the current scope.
4949

5050
## General API Changes
5151

52+
- The minumum supported Node version for all the SDK packages is Node 14 (#10527)
5253
- Remove `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)
5354
- Remove deprecated `deepReadDirSync` export from `@sentry/node` (#10564)
5455
- Remove `_eventFromIncompleteOnError` usage (#10553)
56+
- The `Transaction` integration in `@sentry/integrations` has been removed. There is no replacement API. (#10556)
57+
- `extraErrorDataIntegration` now looks at
58+
[`error.cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) by
59+
default.
5560

5661
# Deprecations in 7.x
5762

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Sentry from '@sentry/browser';
2-
import { ContextLines } from '@sentry/integrations';
2+
import { contextLinesIntegration } from '@sentry/integrations';
33

44
window.Sentry = Sentry;
55

66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
8-
integrations: [new ContextLines()],
8+
integrations: [contextLinesIntegration()],
99
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as Sentry from '@sentry/browser';
2-
import { HttpClient } from '@sentry/integrations';
2+
import { httpClientIntegration } from '@sentry/integrations';
33

44
window.Sentry = Sentry;
55

66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
8-
integrations: [new HttpClient()],
8+
integrations: [httpClientIntegration()],
99
tracesSampleRate: 1,
1010
sendDefaultPii: true,
1111
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as Sentry from '@sentry/browser';
2-
import { HttpClient } from '@sentry/integrations';
2+
import { httpClientIntegration } from '@sentry/integrations';
33

44
window.Sentry = Sentry;
55

66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
8-
integrations: [new HttpClient()],
8+
integrations: [httpClientIntegration()],
99
tracesSampleRate: 1,
1010
sendDefaultPii: true,
1111
});

dev-packages/e2e-tests/test-applications/node-express-app/src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Integrations from '@sentry/integrations';
1+
import { httpClientIntegration } from '@sentry/integrations';
22
import * as Sentry from '@sentry/node';
33
import '@sentry/tracing';
44
import express from 'express';
@@ -13,7 +13,7 @@ Sentry.init({
1313
environment: 'qa', // dynamic sampling bias to keep transactions
1414
dsn: process.env.E2E_TEST_DSN,
1515
includeLocalVariables: true,
16-
integrations: [new Integrations.HttpClient()],
16+
integrations: [httpClientIntegration()],
1717
debug: true,
1818
tunnel: `http://localhost:3031/`, // proxy server
1919
tracesSampleRate: 1,

packages/browser/test/integration/common/init.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var dsn =
2222
function initSDK() {
2323
Sentry.init({
2424
dsn: dsn,
25-
integrations: [new Sentry.Integrations.Dedupe()],
2625
attachStacktrace: true,
2726
ignoreErrors: ['ignoreErrorTest'],
2827
denyUrls: ['foo.js'],

packages/browser/test/package/test-code.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/* eslint-disable no-console */
22
const Sentry = require('../../build/npm/cjs/index.js');
3-
const Integrations = require('../../../integrations/build/npm/cjs/dedupe.js');
43

54
// Init
65
Sentry.init({
76
dsn: 'https://[email protected]/42',
8-
integrations: [new Integrations.Dedupe()],
97
beforeSend(_event) {
108
console.log('Got an event');
119
return null;

packages/integrations/src/captureconsole.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import {
2-
captureException,
3-
captureMessage,
4-
convertIntegrationFnToClass,
5-
defineIntegration,
6-
getClient,
7-
withScope,
8-
} from '@sentry/core';
9-
import type { CaptureContext, Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { captureException, captureMessage, defineIntegration, getClient, withScope } from '@sentry/core';
2+
import type { CaptureContext, IntegrationFn } from '@sentry/types';
103
import {
114
CONSOLE_LEVELS,
125
GLOBAL_OBJ,
@@ -45,19 +38,10 @@ const _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {
4538
};
4639
}) satisfies IntegrationFn;
4740

48-
export const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);
49-
5041
/**
5142
* Send Console API calls as Sentry Events.
52-
* @deprecated Use `captureConsoleIntegration()` instead.
5343
*/
54-
// eslint-disable-next-line deprecation/deprecation
55-
export const CaptureConsole = convertIntegrationFnToClass(
56-
INTEGRATION_NAME,
57-
captureConsoleIntegration,
58-
) as IntegrationClass<Integration & { setup: (client: Client) => void }> & {
59-
new (options?: { levels?: string[] }): Integration;
60-
};
44+
export const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);
6145

6246
function consoleHandler(args: unknown[], level: string): void {
6347
const captureContext: CaptureContext = {

packages/integrations/src/contextlines.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
33
import { GLOBAL_OBJ, addContextToFrame, stripUrlQueryAndFragment } from '@sentry/utils';
44

55
const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
@@ -31,8 +31,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
3131
};
3232
}) satisfies IntegrationFn;
3333

34-
export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);
35-
3634
/**
3735
* Collects source context lines around the lines of stackframes pointing to JS embedded in
3836
* the current page's HTML.
@@ -43,13 +41,8 @@ export const contextLinesIntegration = defineIntegration(_contextLinesIntegratio
4341
*
4442
* Use this integration if you have inline JS code in HTML pages that can't be accessed
4543
* by our backend (e.g. due to a login-protected page).
46-
*
47-
* @deprecated Use `contextLinesIntegration()` instead.
4844
*/
49-
// eslint-disable-next-line deprecation/deprecation
50-
export const ContextLines = convertIntegrationFnToClass(INTEGRATION_NAME, contextLinesIntegration) as IntegrationClass<
51-
Integration & { processEvent: (event: Event) => Event }
52-
> & { new (options?: { frameContextLines?: number }): Integration };
45+
export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);
5346

5447
/**
5548
* Processes an event and adds context lines.

packages/integrations/src/debug.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, EventHint, IntegrationFn } from '@sentry/types';
33
import { consoleSandbox } from '@sentry/utils';
44

55
const INTEGRATION_NAME = 'Debug';
@@ -11,6 +11,10 @@ interface DebugOptions {
1111
debugger?: boolean;
1212
}
1313

14+
/**
15+
* Integration to debug sent Sentry events.
16+
* This integration should not be used in production.
17+
*/
1418
const _debugIntegration = ((options: DebugOptions = {}) => {
1519
const _options = {
1620
debugger: false,
@@ -50,19 +54,3 @@ const _debugIntegration = ((options: DebugOptions = {}) => {
5054
}) satisfies IntegrationFn;
5155

5256
export const debugIntegration = defineIntegration(_debugIntegration);
53-
54-
/**
55-
* Integration to debug sent Sentry events.
56-
* This integration should not be used in production.
57-
*
58-
* @deprecated Use `debugIntegration()` instead.
59-
*/
60-
// eslint-disable-next-line deprecation/deprecation
61-
export const Debug = convertIntegrationFnToClass(INTEGRATION_NAME, debugIntegration) as IntegrationClass<
62-
Integration & { setup: (client: Client) => void }
63-
> & {
64-
new (options?: {
65-
stringify?: boolean;
66-
debugger?: boolean;
67-
}): Integration;
68-
};

packages/integrations/src/dedupe.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Exception, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, Exception, IntegrationFn, StackFrame } from '@sentry/types';
33
import { logger } from '@sentry/utils';
44

55
import { DEBUG_BUILD } from './debug-build';
@@ -33,16 +33,10 @@ const _dedupeIntegration = (() => {
3333
};
3434
}) satisfies IntegrationFn;
3535

36-
export const dedupeIntegration = defineIntegration(_dedupeIntegration);
37-
3836
/**
3937
* Deduplication filter.
40-
* @deprecated Use `dedupeIntegration()` instead.
4138
*/
42-
// eslint-disable-next-line deprecation/deprecation
43-
export const Dedupe = convertIntegrationFnToClass(INTEGRATION_NAME, dedupeIntegration) as IntegrationClass<
44-
Integration & { processEvent: (event: Event) => Event }
45-
>;
39+
export const dedupeIntegration = defineIntegration(_dedupeIntegration);
4640

4741
/** only exported for tests. */
4842
export function _shouldDropEvent(currentEvent: Event, previousEvent?: Event): boolean {

packages/integrations/src/extraerrordata.ts

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type {
3-
Contexts,
4-
Event,
5-
EventHint,
6-
ExtendedError,
7-
Integration,
8-
IntegrationClass,
9-
IntegrationFn,
10-
} from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Contexts, Event, EventHint, ExtendedError, IntegrationFn } from '@sentry/types';
113
import { addNonEnumerableProperty, isError, isPlainObject, logger, normalize } from '@sentry/utils';
124

135
import { DEBUG_BUILD } from './debug-build';
@@ -21,19 +13,18 @@ interface ExtraErrorDataOptions {
2113
depth: number;
2214

2315
/**
24-
* Whether to capture error causes.
16+
* Whether to capture error causes. Defaults to true.
2517
*
2618
* More information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
2719
*/
2820
captureErrorCause: boolean;
2921
}
3022

23+
/**
24+
* Extract additional data for from original exceptions.
25+
*/
3126
const _extraErrorDataIntegration = ((options: Partial<ExtraErrorDataOptions> = {}) => {
32-
const depth = options.depth || 3;
33-
34-
// TODO(v8): Flip the default for this option to true
35-
const captureErrorCause = options.captureErrorCause || false;
36-
27+
const { depth = 3, captureErrorCause = true } = options;
3728
return {
3829
name: INTEGRATION_NAME,
3930
// TODO v8: Remove this
@@ -46,23 +37,6 @@ const _extraErrorDataIntegration = ((options: Partial<ExtraErrorDataOptions> = {
4637

4738
export const extraErrorDataIntegration = defineIntegration(_extraErrorDataIntegration);
4839

49-
/**
50-
* Extract additional data for from original exceptions.
51-
* @deprecated Use `extraErrorDataIntegration()` instead.
52-
*/
53-
// eslint-disable-next-line deprecation/deprecation
54-
export const ExtraErrorData = convertIntegrationFnToClass(
55-
INTEGRATION_NAME,
56-
extraErrorDataIntegration,
57-
) as IntegrationClass<Integration & { processEvent: (event: Event, hint: EventHint) => Event }> & {
58-
new (
59-
options?: Partial<{
60-
depth: number;
61-
captureErrorCause: boolean;
62-
}>,
63-
): Integration;
64-
};
65-
6640
function _enhanceEventWithErrorData(
6741
event: Event,
6842
hint: EventHint = {},

packages/integrations/src/httpclient.ts

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
import {
2-
captureEvent,
3-
convertIntegrationFnToClass,
4-
defineIntegration,
5-
getClient,
6-
isSentryRequestUrl,
7-
} from '@sentry/core';
8-
import type {
9-
Client,
10-
Event as SentryEvent,
11-
Integration,
12-
IntegrationClass,
13-
IntegrationFn,
14-
SentryWrappedXMLHttpRequest,
15-
} from '@sentry/types';
1+
import { captureEvent, defineIntegration, getClient, isSentryRequestUrl } from '@sentry/core';
2+
import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/types';
163
import {
174
GLOBAL_OBJ,
185
SENTRY_XHR_DATA_KEY,
@@ -69,21 +56,10 @@ const _httpClientIntegration = ((options: Partial<HttpClientOptions> = {}) => {
6956
};
7057
}) satisfies IntegrationFn;
7158

72-
export const httpClientIntegration = defineIntegration(_httpClientIntegration);
73-
7459
/**
7560
* Create events for failed client side HTTP requests.
76-
* @deprecated Use `httpClientIntegration()` instead.
7761
*/
78-
// eslint-disable-next-line deprecation/deprecation
79-
export const HttpClient = convertIntegrationFnToClass(INTEGRATION_NAME, httpClientIntegration) as IntegrationClass<
80-
Integration & { setup: (client: Client) => void }
81-
> & {
82-
new (options?: {
83-
failedRequestStatusCodes: HttpStatusCodeRange[];
84-
failedRequestTargets: HttpRequestTarget[];
85-
}): Integration;
86-
};
62+
export const httpClientIntegration = defineIntegration(_httpClientIntegration);
8763

8864
/**
8965
* Interceptor function for fetch requests

packages/integrations/src/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/* eslint-disable deprecation/deprecation */
2-
export { CaptureConsole, captureConsoleIntegration } from './captureconsole';
3-
export { Debug, debugIntegration } from './debug';
4-
export { Dedupe, dedupeIntegration } from './dedupe';
5-
export { ExtraErrorData, extraErrorDataIntegration } from './extraerrordata';
6-
export { ReportingObserver, reportingObserverIntegration } from './reportingobserver';
7-
export { RewriteFrames, rewriteFramesIntegration } from './rewriteframes';
8-
export { SessionTiming, sessionTimingIntegration } from './sessiontiming';
9-
export { Transaction } from './transaction';
10-
export { HttpClient, httpClientIntegration } from './httpclient';
11-
export { ContextLines, contextLinesIntegration } from './contextlines';
1+
export { captureConsoleIntegration } from './captureconsole';
2+
export { debugIntegration } from './debug';
3+
export { dedupeIntegration } from './dedupe';
4+
export { extraErrorDataIntegration } from './extraerrordata';
5+
export { reportingObserverIntegration } from './reportingobserver';
6+
export { rewriteFramesIntegration } from './rewriteframes';
7+
export { sessionTimingIntegration } from './sessiontiming';
8+
export { httpClientIntegration } from './httpclient';
9+
export { contextLinesIntegration } from './contextlines';

packages/integrations/src/reportingobserver.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { captureMessage, convertIntegrationFnToClass, defineIntegration, getClient, withScope } from '@sentry/core';
2-
import type { Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { captureMessage, defineIntegration, getClient, withScope } from '@sentry/core';
2+
import type { Client, IntegrationFn } from '@sentry/types';
33
import { GLOBAL_OBJ, supportsReportingObserver } from '@sentry/utils';
44

55
const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
@@ -115,18 +115,7 @@ const _reportingObserverIntegration = ((options: ReportingObserverOptions = {})
115115
};
116116
}) satisfies IntegrationFn;
117117

118-
export const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);
119-
120118
/**
121119
* Reporting API integration - https://w3c.github.io/reporting/
122-
* @deprecated Use `reportingObserverIntegration()` instead.
123120
*/
124-
// eslint-disable-next-line deprecation/deprecation
125-
export const ReportingObserver = convertIntegrationFnToClass(
126-
INTEGRATION_NAME,
127-
reportingObserverIntegration,
128-
) as IntegrationClass<Integration & { setup: (client: Client) => void }> & {
129-
new (options?: {
130-
types?: ReportTypes[];
131-
}): Integration;
132-
};
121+
export const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);

0 commit comments

Comments
 (0)