Skip to content

ref(integrations): Delete deprecated class integrations #10887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
defaultIntegrations: false,
integrations: [new Sentry.Integrations.Breadcrumbs()],
integrations: [Sentry.breadcrumbsIntegration()],
sampleRate: 1,
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
defaultIntegrations: false,
integrations: [new Sentry.Integrations.Breadcrumbs()],
integrations: [Sentry.breadcrumbsIntegration()],
sampleRate: 1,
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
defaultIntegrations: false,
integrations: [new Sentry.Integrations.Breadcrumbs()],
integrations: [Sentry.breadcrumbsIntegration()],
sampleRate: 1,
});
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import {
Breadcrumbs,
BrowserClient,
FunctionToString,
HttpContext,
Hub,
InboundFilters,
LinkedErrors,
breadcrumbsIntegration,
dedupeIntegration,
defaultStackParser,
functionToStringIntegration,
httpContextIntegration,
inboundFiltersIntegration,
linkedErrorsIntegration,
makeFetchTransport,
} from '@sentry/browser';

const integrations = [
new Breadcrumbs(),
new FunctionToString(),
breadcrumbsIntegration(),
functionToStringIntegration(),
dedupeIntegration(),
new HttpContext(),
new InboundFilters(),
new LinkedErrors(),
httpContextIntegration(),
inboundFiltersIntegration(),
linkedErrorsIntegration(),
];

const client = new BrowserClient({
Expand Down
7 changes: 0 additions & 7 deletions packages/browser/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ export {
withScope,
withIsolationScope,
withActiveSpan,
// eslint-disable-next-line deprecation/deprecation
FunctionToString,
// eslint-disable-next-line deprecation/deprecation
InboundFilters,
functionToStringIntegration,
inboundFiltersIntegration,
dedupeIntegration,
Expand Down Expand Up @@ -113,6 +109,3 @@ export { globalHandlersIntegration } from './integrations/globalhandlers';
export { httpContextIntegration } from './integrations/httpcontext';
export { linkedErrorsIntegration } from './integrations/linkederrors';
export { browserApiErrorsIntegration } from './integrations/browserapierrors';

// eslint-disable-next-line deprecation/deprecation
export { Breadcrumbs, LinkedErrors, HttpContext } from './integrations';
5 changes: 0 additions & 5 deletions packages/browser/src/index.bundle.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import type { IntegrationFn } from '@sentry/types/src';

export * from './exports';

import { Integrations as CoreIntegrations } from '@sentry/core';
import type { Integration } from '@sentry/types';

import { WINDOW } from './helpers';
import * as BrowserIntegrations from './integrations';

let windowIntegrations = {};

Expand All @@ -18,9 +16,6 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const INTEGRATIONS: Record<string, (new (...args: any[]) => Integration) | IntegrationFn> = {
...windowIntegrations,
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
...BrowserIntegrations,
};

export { INTEGRATIONS as Integrations };
6 changes: 0 additions & 6 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
export * from './exports';

import { Integrations as CoreIntegrations } from '@sentry/core';

import { WINDOW } from './helpers';
import * as BrowserIntegrations from './integrations';

let windowIntegrations = {};

Expand All @@ -15,9 +12,6 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) {
/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */
const INTEGRATIONS = {
...windowIntegrations,
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
...BrowserIntegrations,
};

// eslint-disable-next-line deprecation/deprecation
Expand Down
30 changes: 1 addition & 29 deletions packages/browser/src/integrations/breadcrumbs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable max-lines */
import { addBreadcrumb, convertIntegrationFnToClass, defineIntegration, getClient } from '@sentry/core';
import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core';
import type {
Client,
Event as SentryEvent,
Expand All @@ -8,8 +8,6 @@ import type {
HandlerDataFetch,
HandlerDataHistory,
HandlerDataXhr,
Integration,
IntegrationClass,
IntegrationFn,
} from '@sentry/types';
import type {
Expand Down Expand Up @@ -95,32 +93,6 @@ const _breadcrumbsIntegration = ((options: Partial<BreadcrumbsOptions> = {}) =>

export const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration);

/**
* Default Breadcrumbs instrumentations
*
* @deprecated Use `breadcrumbsIntegration()` instead.
*/
// eslint-disable-next-line deprecation/deprecation
export const Breadcrumbs = convertIntegrationFnToClass(INTEGRATION_NAME, breadcrumbsIntegration) as IntegrationClass<
Integration & { setup: (client: Client) => void }
> & {
new (
options?: Partial<{
console: boolean;
dom:
| boolean
| {
serializeAttribute?: string | string[];
maxStringLength?: number;
};
fetch: boolean;
history: boolean;
sentry: boolean;
xhr: boolean;
}>,
): Integration;
};

/**
* Adds a breadcrumb for Sentry events or transactions if this option is enabled.
*/
Expand Down
4 changes: 0 additions & 4 deletions packages/browser/src/integrations/index.ts

This file was deleted.

13 changes: 8 additions & 5 deletions packages/browser/test/unit/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { InboundFilters, SDK_VERSION, getGlobalScope, getIsolationScope, getReportDialogEndpoint } from '@sentry/core';
import {
SDK_VERSION,
getGlobalScope,
getIsolationScope,
getReportDialogEndpoint,
inboundFiltersIntegration,
} from '@sentry/core';
import type { WrappedFunction } from '@sentry/types';
import * as utils from '@sentry/utils';

Expand Down Expand Up @@ -270,10 +276,7 @@ describe('SentryBrowser', () => {
const options = getDefaultBrowserClientOptions({
beforeSend: localBeforeSend,
dsn,
integrations: [
// eslint-disable-next-line deprecation/deprecation
new InboundFilters({ ignoreErrors: ['capture'] }),
],
integrations: [inboundFiltersIntegration({ ignoreErrors: ['capture'] })],
});
const client = new BrowserClient(options);
setCurrentClient(client);
Expand Down
5 changes: 2 additions & 3 deletions packages/browser/test/unit/integrations/breadcrumbs.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import * as SentryCore from '@sentry/core';

import { Breadcrumbs, BrowserClient, flush } from '../../../src';
import { BrowserClient, breadcrumbsIntegration, flush } from '../../../src';
import { getDefaultBrowserClientOptions } from '../helper/browser-client-options';

describe('Breadcrumbs', () => {
it('Should add sentry breadcrumb', async () => {
const client = new BrowserClient({
...getDefaultBrowserClientOptions(),
dsn: 'https://username@domain/123',
// eslint-disable-next-line deprecation/deprecation
integrations: [new Breadcrumbs()],
integrations: [breadcrumbsIntegration()],
});

SentryCore.setCurrentClient(client);
Expand Down
3 changes: 0 additions & 3 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,11 @@ export {
init,
} from './sdk';

import { Integrations as CoreIntegrations } from '@sentry/core';
import { Integrations as NodeIntegrations } from '@sentry/node-experimental';
import { BunServer } from './integrations/bunserver';
export { bunServerIntegration } from './integrations/bunserver';

const INTEGRATIONS = {
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
...NodeIntegrations,
BunServer,
};
Expand Down
11 changes: 0 additions & 11 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ export { DEFAULT_ENVIRONMENT } from './constants';
/* eslint-disable deprecation/deprecation */
export { ModuleMetadata } from './integrations/metadata';
export { RequestData } from './integrations/requestdata';
export { InboundFilters } from './integrations/inboundfilters';
export { FunctionToString } from './integrations/functiontostring';
export { LinkedErrors } from './integrations/linkederrors';
export { addBreadcrumb } from './breadcrumbs';
/* eslint-enable deprecation/deprecation */
import * as INTEGRATIONS from './integrations';
export { functionToStringIntegration } from './integrations/functiontostring';
export { inboundFiltersIntegration } from './integrations/inboundfilters';
export { linkedErrorsIntegration } from './integrations/linkederrors';
Expand All @@ -118,9 +113,3 @@ export { metrics } from './metrics/exports';
export type { MetricData } from './metrics/exports';
export { metricsDefault } from './metrics/exports-default';
export { BrowserMetricsAggregator } from './metrics/browser-aggregator';

/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */
const Integrations = INTEGRATIONS;

// eslint-disable-next-line deprecation/deprecation
export { Integrations };
26 changes: 2 additions & 24 deletions packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
import { getEventDescription, logger, stringMatchesSomePattern } from '@sentry/utils';

import { DEBUG_BUILD } from '../debug-build';
import { convertIntegrationFnToClass, defineIntegration } from '../integration';
import { defineIntegration } from '../integration';

// "Script error." is hard coded into browsers for errors that it can't read.
// this is the result of a script being pulled in from an external domain and CORS.
Expand Down Expand Up @@ -36,28 +36,6 @@ const _inboundFiltersIntegration = ((options: Partial<InboundFiltersOptions> = {

export const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration);

/**
* Inbound filters configurable by the user.
* @deprecated Use `inboundFiltersIntegration()` instead.
*/
// eslint-disable-next-line deprecation/deprecation
export const InboundFilters = convertIntegrationFnToClass(
INTEGRATION_NAME,
inboundFiltersIntegration,
) as IntegrationClass<Integration & { preprocessEvent: (event: Event, hint: EventHint, client: Client) => void }> & {
new (
options?: Partial<{
allowUrls: Array<string | RegExp>;
denyUrls: Array<string | RegExp>;
ignoreErrors: Array<string | RegExp>;
ignoreTransactions: Array<string | RegExp>;
ignoreInternal: boolean;
disableErrorDefaults: boolean;
disableTransactionDefaults: boolean;
}>,
): Integration;
};

function _mergeOptions(
internalOptions: Partial<InboundFiltersOptions> = {},
clientOptions: Partial<InboundFiltersOptions> = {},
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/integrations/index.ts

This file was deleted.

13 changes: 2 additions & 11 deletions packages/core/src/integrations/linkederrors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
import type { IntegrationFn } from '@sentry/types';
import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils';
import { convertIntegrationFnToClass, defineIntegration } from '../integration';
import { defineIntegration } from '../integration';

interface LinkedErrorsOptions {
key?: string;
Expand Down Expand Up @@ -35,12 +35,3 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {
}) satisfies IntegrationFn;

export const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);

/**
* Adds SDK info to an event.
* @deprecated Use `linkedErrorsIntegration()` instead.
*/
// eslint-disable-next-line deprecation/deprecation
export const LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration) as IntegrationClass<
Integration & { preprocessEvent: (event: Event, hint: EventHint, client: Client) => void }
> & { new (options?: { key?: string; limit?: number }): Integration };
5 changes: 2 additions & 3 deletions packages/core/test/lib/integrations/inboundfilters.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Event, EventProcessor } from '@sentry/types';

import type { InboundFiltersOptions } from '../../../src/integrations/inboundfilters';
import { InboundFilters } from '../../../src/integrations/inboundfilters';
import { inboundFiltersIntegration } from '../../../src/integrations/inboundfilters';
import { TestClient, getDefaultTestClientOptions } from '../../mocks/client';

const PUBLIC_DSN = 'https://username@domain/123';
Expand Down Expand Up @@ -33,8 +33,7 @@ function createInboundFiltersEventProcessor(
dsn: PUBLIC_DSN,
...clientOptions,
defaultIntegrations: false,
// eslint-disable-next-line deprecation/deprecation
integrations: [new InboundFilters(options)],
integrations: [inboundFiltersIntegration(options)],
}),
);

Expand Down
4 changes: 0 additions & 4 deletions packages/deno/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ export {
init,
} from './sdk';

import { Integrations as CoreIntegrations } from '@sentry/core';

export { denoContextIntegration } from './integrations/context';
export { globalHandlersIntegration } from './integrations/globalhandlers';
export { normalizePathsIntegration } from './integrations/normalizepaths';
Expand All @@ -108,7 +106,5 @@ import * as DenoIntegrations from './integrations';

/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */
export const Integrations = {
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
...DenoIntegrations,
};
4 changes: 0 additions & 4 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,12 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from

export { createGetModuleFromFilename } from './module';

import { Integrations as CoreIntegrations } from '@sentry/core';

import * as Handlers from './handlers';
import * as NodeIntegrations from './integrations';
import * as TracingIntegrations from './tracing/integrations';

// TODO: Deprecate this once we migrated tracing integrations
export const Integrations = {
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
...NodeIntegrations,
...TracingIntegrations,
};
Expand Down
Loading