diff --git a/MIGRATION.md b/MIGRATION.md index 49be1f12de03..7927dd6b49a0 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -18,6 +18,24 @@ be removed. Instead of `getCurrentHub()`, use the respective replacement API directly - see [Deprecate Hub](#deprecate-hub) for details. +## Deprecate class-based integrations + +In v7, integrations are classes and can be added as e.g. `integrations: [new Sentry.Integrations.ContextLines()]`. In +v8, integrations will not be classes anymore, but instead functions. Both the use as a class, as well as accessing +integrations from the `Integrations.XXX` hash, is deprecated in favor of using the new functional integrations + +- for example, `new Integrations.LinkedErrors()` becomes `linkedErrorsIntegration()`. + +The following list shows how integrations should be migrated: + +| Old | New | +| ------------------------ | ------------------------------- | +| `new InboundFilters()` | `inboundFiltersIntegrations()` | +| `new FunctionToString()` | `functionToStringIntegration()` | +| `new LinkedErrors()` | `linkedErrorsIntegration()` | +| `new ModuleMetadata()` | `moduleMetadataIntegration()` | +| `new RequestData()` | `requestDataIntegration()` | + ## Deprecate `hub.bindClient()` and `makeMain()` Instead, either directly use `initAndBind()`, or the new APIs `setCurrentClient()` and `client.init()`. See diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index 6a7e81e0f1a5..0ff189977701 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -65,9 +65,13 @@ export { setUser, withScope, withIsolationScope, + // eslint-disable-next-line deprecation/deprecation FunctionToString, + // eslint-disable-next-line deprecation/deprecation InboundFilters, metrics, + functionToStringIntegration, + inboundFiltersIntegration, } from '@sentry/core'; export { WINDOW } from './helpers'; diff --git a/packages/browser/src/index.bundle.base.ts b/packages/browser/src/index.bundle.base.ts index 464a1170d138..304d1c4f16d1 100644 --- a/packages/browser/src/index.bundle.base.ts +++ b/packages/browser/src/index.bundle.base.ts @@ -16,6 +16,7 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const INTEGRATIONS: Record Integration> = { ...windowIntegrations, + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...BrowserIntegrations, }; diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 97abefea8242..d4c2493bb787 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -14,6 +14,7 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) { const INTEGRATIONS = { ...windowIntegrations, + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...BrowserIntegrations, }; @@ -52,7 +53,9 @@ export { // eslint-disable-next-line deprecation/deprecation trace, makeMultiplexedTransport, + // eslint-disable-next-line deprecation/deprecation ModuleMetadata, + moduleMetadataIntegration, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; export type { Span } from '@sentry/types'; diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index 929222400ff9..0b64dd0c2735 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -1,6 +1,7 @@ import type { Hub } from '@sentry/core'; import { - Integrations as CoreIntegrations, + FunctionToString, + InboundFilters, captureSession, getClient, getCurrentHub, @@ -26,9 +27,10 @@ import { Breadcrumbs, Dedupe, GlobalHandlers, HttpContext, LinkedErrors, TryCatc import { defaultStackParser } from './stack-parsers'; import { makeFetchTransport, makeXHRTransport } from './transports'; +/* eslint-disable deprecation/deprecation */ export const defaultIntegrations = [ - new CoreIntegrations.InboundFilters(), - new CoreIntegrations.FunctionToString(), + new InboundFilters(), + new FunctionToString(), new TryCatch(), new Breadcrumbs(), new GlobalHandlers(), @@ -36,6 +38,7 @@ export const defaultIntegrations = [ new Dedupe(), new HttpContext(), ]; +/* eslint-enable deprecation/deprecation */ /** * A magic string that build tooling can leverage in order to inject a release value into the SDK. diff --git a/packages/browser/test/unit/index.test.ts b/packages/browser/test/unit/index.test.ts index 3a9e06be9ec6..fe884ccc5438 100644 --- a/packages/browser/test/unit/index.test.ts +++ b/packages/browser/test/unit/index.test.ts @@ -1,4 +1,4 @@ -import { SDK_VERSION, getReportDialogEndpoint } from '@sentry/core'; +import { InboundFilters, SDK_VERSION, getReportDialogEndpoint } from '@sentry/core'; import type { WrappedFunction } from '@sentry/types'; import * as utils from '@sentry/utils'; @@ -6,7 +6,6 @@ import type { Event } from '../../src'; import { setCurrentClient } from '../../src'; import { BrowserClient, - Integrations, Scope, WINDOW, addBreadcrumb, @@ -269,7 +268,10 @@ describe('SentryBrowser', () => { const options = getDefaultBrowserClientOptions({ beforeSend: localBeforeSend, dsn, - integrations: [new Integrations.InboundFilters({ ignoreErrors: ['capture'] })], + integrations: [ + // eslint-disable-next-line deprecation/deprecation + new InboundFilters({ ignoreErrors: ['capture'] }), + ], }); const client = new BrowserClient(options); setCurrentClient(client); diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index 0b980146d5bb..2f6794b4dae9 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -79,6 +79,10 @@ export { startSpanManual, continueTrace, metrics, + functionToStringIntegration, + inboundFiltersIntegration, + linkedErrorsIntegration, + requestDataIntegration, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; export { autoDiscoverNodePerformanceMonitoringIntegrations, cron } from '@sentry/node'; @@ -92,6 +96,7 @@ import { Integrations as NodeIntegrations } from '@sentry/node'; import * as BunIntegrations from './integrations'; const INTEGRATIONS = { + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...NodeIntegrations, ...BunIntegrations, diff --git a/packages/bun/src/sdk.ts b/packages/bun/src/sdk.ts index 8604ace1962d..1288820e2401 100644 --- a/packages/bun/src/sdk.ts +++ b/packages/bun/src/sdk.ts @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import { Integrations as CoreIntegrations } from '@sentry/core'; +import { FunctionToString, InboundFilters, LinkedErrors } from '@sentry/core'; import { Integrations as NodeIntegrations, init as initNode } from '@sentry/node'; import { BunClient } from './client'; @@ -7,11 +7,12 @@ import { BunServer } from './integrations'; import { makeFetchTransport } from './transports'; import type { BunOptions } from './types'; +/* eslint-disable deprecation/deprecation */ export const defaultIntegrations = [ // Common - new CoreIntegrations.InboundFilters(), - new CoreIntegrations.FunctionToString(), - new CoreIntegrations.LinkedErrors(), + new InboundFilters(), + new FunctionToString(), + new LinkedErrors(), // Native Wrappers new NodeIntegrations.Console(), new NodeIntegrations.Http(), @@ -28,6 +29,7 @@ export const defaultIntegrations = [ // Bun Specific new BunServer(), ]; +/* eslint-enable deprecation/deprecation */ /** * The Sentry Bun SDK Client. diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index d6c20e8fa27d..c72d05675236 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -69,10 +69,10 @@ export { SDK_VERSION } from './version'; export { getIntegrationsToSetup, addIntegration, + defineIntegration, // eslint-disable-next-line deprecation/deprecation convertIntegrationFnToClass, } from './integration'; -export { FunctionToString, InboundFilters, LinkedErrors } from './integrations'; export { applyScopeDataToEvent, mergeScopeData } from './utils/applyScopeDataToEvent'; export { prepareEvent } from './utils/prepareEvent'; export { createCheckInEnvelope } from './checkin'; @@ -86,9 +86,23 @@ export { } from './utils/spanUtils'; export { getRootSpan } from './utils/getRootSpan'; export { DEFAULT_ENVIRONMENT } from './constants'; +/* eslint-disable deprecation/deprecation */ export { ModuleMetadata } from './integrations/metadata'; export { RequestData } from './integrations/requestdata'; -import * as Integrations from './integrations'; +export { InboundFilters } from './integrations/inboundfilters'; +export { FunctionToString } from './integrations/functiontostring'; +export { LinkedErrors } from './integrations/linkederrors'; +/* eslint-enable deprecation/deprecation */ +import * as INTEGRATIONS from './integrations'; +export { functionToStringIntegration } from './integrations/functiontostring'; +export { inboundFiltersIntegration } from './integrations/inboundfilters'; +export { linkedErrorsIntegration } from './integrations/linkederrors'; +export { moduleMetadataIntegration } from './integrations/metadata'; +export { requestDataIntegration } from './integrations/requestdata'; export { metrics } from './metrics/exports'; +/** @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 }; diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts index 6b63b6fb7f85..5b126459390b 100644 --- a/packages/core/src/integration.ts +++ b/packages/core/src/integration.ts @@ -1,4 +1,13 @@ -import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn, Options } from '@sentry/types'; +import type { + Client, + Event, + EventHint, + Integration, + IntegrationClass, + IntegrationFn, + IntegrationFnResult, + Options, +} from '@sentry/types'; import { arrayify, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; @@ -177,3 +186,11 @@ export function convertIntegrationFnToClass( { id: name }, ) as unknown as IntegrationClass; } + +/** + * Define an integration function that can be used to create an integration instance. + * Note that this by design hides the implementation details of the integration, as they are considered internal. + */ +export function defineIntegration(fn: Fn): (...args: Parameters) => IntegrationFnResult { + return fn; +} diff --git a/packages/core/src/integrations/functiontostring.ts b/packages/core/src/integrations/functiontostring.ts index 112899d525ac..7a50aec67f2d 100644 --- a/packages/core/src/integrations/functiontostring.ts +++ b/packages/core/src/integrations/functiontostring.ts @@ -1,12 +1,12 @@ import type { Integration, IntegrationClass, IntegrationFn, WrappedFunction } from '@sentry/types'; import { getOriginalFunction } from '@sentry/utils'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, defineIntegration } from '../integration'; let originalFunctionToString: () => void; const INTEGRATION_NAME = 'FunctionToString'; -const functionToStringIntegration = (() => { +const _functionToStringIntegration = (() => { return { name: INTEGRATION_NAME, setupOnce() { @@ -28,7 +28,12 @@ const functionToStringIntegration = (() => { }; }) satisfies IntegrationFn; -/** Patch toString calls to return proper name for wrapped functions */ +export const functionToStringIntegration = defineIntegration(_functionToStringIntegration); + +/** + * Patch toString calls to return proper name for wrapped functions. + * @deprecated Use `functionToStringIntegration()` instead. + */ // eslint-disable-next-line deprecation/deprecation export const FunctionToString = convertIntegrationFnToClass( INTEGRATION_NAME, diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/inboundfilters.ts index 42cbfbae7e46..6ed891c253fa 100644 --- a/packages/core/src/integrations/inboundfilters.ts +++ b/packages/core/src/integrations/inboundfilters.ts @@ -2,7 +2,7 @@ import type { Client, Event, EventHint, Integration, IntegrationClass, Integrati import { getEventDescription, logger, stringMatchesSomePattern } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, 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. @@ -30,7 +30,7 @@ export interface InboundFiltersOptions { } const INTEGRATION_NAME = 'InboundFilters'; -const inboundFiltersIntegration = ((options: Partial = {}) => { +const _inboundFiltersIntegration = ((options: Partial = {}) => { return { name: INTEGRATION_NAME, // TODO v8: Remove this @@ -43,7 +43,12 @@ const inboundFiltersIntegration = ((options: Partial = {} }; }) satisfies IntegrationFn; -/** Inbound filters configurable by the user */ +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, diff --git a/packages/core/src/integrations/index.ts b/packages/core/src/integrations/index.ts index 5e81ff7a7754..7e2dc7fa5094 100644 --- a/packages/core/src/integrations/index.ts +++ b/packages/core/src/integrations/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable deprecation/deprecation */ export { FunctionToString } from './functiontostring'; export { InboundFilters } from './inboundfilters'; export { LinkedErrors } from './linkederrors'; diff --git a/packages/core/src/integrations/linkederrors.ts b/packages/core/src/integrations/linkederrors.ts index 1b0b5135a2f1..e753ca2ccd75 100644 --- a/packages/core/src/integrations/linkederrors.ts +++ b/packages/core/src/integrations/linkederrors.ts @@ -1,6 +1,6 @@ import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types'; import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, defineIntegration } from '../integration'; interface LinkedErrorsOptions { key?: string; @@ -12,7 +12,7 @@ const DEFAULT_LIMIT = 5; const INTEGRATION_NAME = 'LinkedErrors'; -const linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => { +const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => { const limit = options.limit || DEFAULT_LIMIT; const key = options.key || DEFAULT_KEY; @@ -36,7 +36,12 @@ const linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => { }; }) satisfies IntegrationFn; -/** Adds SDK info to an event. */ +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 } diff --git a/packages/core/src/integrations/metadata.ts b/packages/core/src/integrations/metadata.ts index 652aa081529c..d4e48620d726 100644 --- a/packages/core/src/integrations/metadata.ts +++ b/packages/core/src/integrations/metadata.ts @@ -1,12 +1,12 @@ import type { Client, Event, EventHint, EventItem, Integration, IntegrationClass, IntegrationFn } from '@sentry/types'; import { forEachEnvelopeItem } from '@sentry/utils'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, defineIntegration } from '../integration'; import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata'; const INTEGRATION_NAME = 'ModuleMetadata'; -const moduleMetadataIntegration = (() => { +const _moduleMetadataIntegration = (() => { return { name: INTEGRATION_NAME, // TODO v8: Remove this @@ -39,6 +39,8 @@ const moduleMetadataIntegration = (() => { }; }) satisfies IntegrationFn; +export const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegration); + /** * Adds module metadata to stack frames. * @@ -47,6 +49,8 @@ const moduleMetadataIntegration = (() => { * When this integration is added, the metadata passed to the bundler plugin is added to the stack frames of all events * under the `module_metadata` property. This can be used to help in tagging or routing of events from different teams * our sources + * + * @deprecated Use `moduleMetadataIntegration()` instead. */ // eslint-disable-next-line deprecation/deprecation export const ModuleMetadata = convertIntegrationFnToClass( diff --git a/packages/core/src/integrations/requestdata.ts b/packages/core/src/integrations/requestdata.ts index 80d587e09a57..d3aa6bb7b850 100644 --- a/packages/core/src/integrations/requestdata.ts +++ b/packages/core/src/integrations/requestdata.ts @@ -9,7 +9,7 @@ import type { } from '@sentry/types'; import type { AddRequestDataToEventOptions, TransactionNamingScheme } from '@sentry/utils'; import { addRequestDataToEvent, extractPathForTransaction } from '@sentry/utils'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, defineIntegration } from '../integration'; import { spanToJSON } from '../utils/spanUtils'; export type RequestDataIntegrationOptions = { @@ -55,7 +55,7 @@ const DEFAULT_OPTIONS = { const INTEGRATION_NAME = 'RequestData'; -const requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) => { +const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) => { const _addRequestData = addRequestDataToEvent; const _options: Required = { ...DEFAULT_OPTIONS, @@ -139,8 +139,13 @@ const requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) => }; }) satisfies IntegrationFn; -/** Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/integrations` - * so it can be used in cross-platform SDKs like `@sentry/nextjs`. */ +export const requestDataIntegration = defineIntegration(_requestDataIntegration); + +/** + * Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/integrations` + * so it can be used in cross-platform SDKs like `@sentry/nextjs`. + * @deprecated Use `requestDataIntegration()` instead. + */ // eslint-disable-next-line deprecation/deprecation export const RequestData = convertIntegrationFnToClass(INTEGRATION_NAME, requestDataIntegration) as IntegrationClass< Integration & { processEvent: (event: Event, hint: EventHint, client: Client) => Event } diff --git a/packages/core/src/metrics/exports.ts b/packages/core/src/metrics/exports.ts index 03e81ed49f0e..20d63a2ca119 100644 --- a/packages/core/src/metrics/exports.ts +++ b/packages/core/src/metrics/exports.ts @@ -5,7 +5,7 @@ import { DEBUG_BUILD } from '../debug-build'; import { getClient, getCurrentScope } from '../exports'; import { spanToJSON } from '../utils/spanUtils'; import { COUNTER_METRIC_TYPE, DISTRIBUTION_METRIC_TYPE, GAUGE_METRIC_TYPE, SET_METRIC_TYPE } from './constants'; -import { MetricsAggregator } from './integration'; +import { MetricsAggregator, metricsAggregatorIntegration } from './integration'; import type { MetricType } from './types'; interface MetricData { @@ -89,5 +89,8 @@ export const metrics = { distribution, set, gauge, + /** @deprecated Use `metrics.metricsAggregratorIntegration()` instead. */ + // eslint-disable-next-line deprecation/deprecation MetricsAggregator, + metricsAggregatorIntegration, }; diff --git a/packages/core/src/metrics/integration.ts b/packages/core/src/metrics/integration.ts index d4c77c6b61fe..af797bd8adf4 100644 --- a/packages/core/src/metrics/integration.ts +++ b/packages/core/src/metrics/integration.ts @@ -1,11 +1,11 @@ import type { Client, ClientOptions, Integration, IntegrationClass, IntegrationFn } from '@sentry/types'; import type { BaseClient } from '../baseclient'; -import { convertIntegrationFnToClass } from '../integration'; +import { convertIntegrationFnToClass, defineIntegration } from '../integration'; import { BrowserMetricsAggregator } from './browser-aggregator'; const INTEGRATION_NAME = 'MetricsAggregator'; -const metricsAggregatorIntegration = (() => { +const _metricsAggregatorIntegration = (() => { return { name: INTEGRATION_NAME, // TODO v8: Remove this @@ -16,10 +16,13 @@ const metricsAggregatorIntegration = (() => { }; }) satisfies IntegrationFn; +export const metricsAggregatorIntegration = defineIntegration(_metricsAggregatorIntegration); + /** * Enables Sentry metrics monitoring. * * @experimental This API is experimental and might having breaking changes in the future. + * @deprecated Use `metricsAggegratorIntegration()` instead. */ // eslint-disable-next-line deprecation/deprecation export const MetricsAggregator = convertIntegrationFnToClass( diff --git a/packages/core/test/lib/integrations/functiontostring.test.ts b/packages/core/test/lib/integrations/functiontostring.test.ts index cbe664ae10fc..bb3b62d11915 100644 --- a/packages/core/test/lib/integrations/functiontostring.test.ts +++ b/packages/core/test/lib/integrations/functiontostring.test.ts @@ -17,6 +17,7 @@ describe('FunctionToString', () => { expect(foo.bar.toString()).not.toBe(originalFunction); + // eslint-disable-next-line deprecation/deprecation const fts = new FunctionToString(); fts.setupOnce(); diff --git a/packages/core/test/lib/integrations/inboundfilters.test.ts b/packages/core/test/lib/integrations/inboundfilters.test.ts index b49b4b18671f..24783b8eeb68 100644 --- a/packages/core/test/lib/integrations/inboundfilters.test.ts +++ b/packages/core/test/lib/integrations/inboundfilters.test.ts @@ -33,6 +33,7 @@ function createInboundFiltersEventProcessor( dsn: PUBLIC_DSN, ...clientOptions, defaultIntegrations: false, + // eslint-disable-next-line deprecation/deprecation integrations: [new InboundFilters(options)], }), ); diff --git a/packages/core/test/lib/integrations/metadata.test.ts b/packages/core/test/lib/integrations/metadata.test.ts index 1a20ffaee73d..d81948a8e495 100644 --- a/packages/core/test/lib/integrations/metadata.test.ts +++ b/packages/core/test/lib/integrations/metadata.test.ts @@ -27,6 +27,7 @@ describe('ModuleMetadata integration', () => { dsn: 'https://username@domain/123', enableSend: true, stackParser, + // eslint-disable-next-line deprecation/deprecation integrations: [new ModuleMetadata()], beforeSend: (event, _hint) => { // copy the frames since reverse in in-place diff --git a/packages/core/test/lib/integrations/requestdata.test.ts b/packages/core/test/lib/integrations/requestdata.test.ts index 37d624d6e757..e82638fd2e2e 100644 --- a/packages/core/test/lib/integrations/requestdata.test.ts +++ b/packages/core/test/lib/integrations/requestdata.test.ts @@ -17,6 +17,7 @@ const path = '/by/the/trees/'; const queryString = 'chase=me&please=thankyou'; function initWithRequestDataIntegrationOptions(integrationOptions: RequestDataIntegrationOptions): EventProcessor { + // eslint-disable-next-line deprecation/deprecation const requestDataIntegration = new RequestData({ ...integrationOptions, }); diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 143503b58fda..4a300046cc68 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -77,6 +77,10 @@ export { startInactiveSpan, startSpanManual, metrics, + inboundFiltersIntegration, + linkedErrorsIntegration, + functionToStringIntegration, + requestDataIntegration, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; @@ -89,6 +93,7 @@ import { Integrations as CoreIntegrations } from '@sentry/core'; import * as DenoIntegrations from './integrations'; const INTEGRATIONS = { + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...DenoIntegrations, }; diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index af33449edafd..09416b453394 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -1,6 +1,7 @@ import { Breadcrumbs, Dedupe } from '@sentry/browser'; import type { ServerRuntimeClientOptions } from '@sentry/core'; -import { Integrations as CoreIntegrations, getIntegrationsToSetup, initAndBind } from '@sentry/core'; +import { FunctionToString, InboundFilters, LinkedErrors } from '@sentry/core'; +import { getIntegrationsToSetup, initAndBind } from '@sentry/core'; import type { StackParser } from '@sentry/types'; import { createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/utils'; @@ -9,11 +10,12 @@ import { ContextLines, DenoContext, GlobalHandlers, NormalizePaths } from './int import { makeFetchTransport } from './transports'; import type { DenoOptions } from './types'; +/* eslint-disable deprecation/deprecation */ export const defaultIntegrations = [ // Common - new CoreIntegrations.InboundFilters(), - new CoreIntegrations.FunctionToString(), - new CoreIntegrations.LinkedErrors(), + new InboundFilters(), + new FunctionToString(), + new LinkedErrors(), // From Browser new Dedupe(), new Breadcrumbs({ @@ -27,6 +29,7 @@ export const defaultIntegrations = [ new NormalizePaths(), new GlobalHandlers(), ]; +/* eslint-enable deprecation/deprecation */ const defaultStackParser: StackParser = createStackParser(nodeStackLineParser()); diff --git a/packages/node-experimental/src/index.ts b/packages/node-experimental/src/index.ts index 73fafb2ebc8e..8a6a60dfcd48 100644 --- a/packages/node-experimental/src/index.ts +++ b/packages/node-experimental/src/index.ts @@ -3,6 +3,7 @@ import { Integrations as CoreIntegrations } from '@sentry/core'; import * as NodeExperimentalIntegrations from './integrations'; const INTEGRATIONS = { + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...NodeExperimentalIntegrations, }; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 73d34526a658..72c7528b0606 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -80,6 +80,10 @@ export { startSpanManual, continueTrace, metrics, + functionToStringIntegration, + inboundFiltersIntegration, + linkedErrorsIntegration, + requestDataIntegration, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; export { autoDiscoverNodePerformanceMonitoringIntegrations } from './tracing'; @@ -108,6 +112,7 @@ import * as NodeIntegrations from './integrations'; import * as TracingIntegrations from './tracing/integrations'; const INTEGRATIONS = { + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, ...NodeIntegrations, ...TracingIntegrations, diff --git a/packages/node/src/integrations/index.ts b/packages/node/src/integrations/index.ts index 92c58bbe5b8d..3e1a60f6951f 100644 --- a/packages/node/src/integrations/index.ts +++ b/packages/node/src/integrations/index.ts @@ -5,6 +5,7 @@ export { OnUnhandledRejection } from './onunhandledrejection'; export { Modules } from './modules'; export { ContextLines } from './contextlines'; export { Context } from './context'; +// eslint-disable-next-line deprecation/deprecation export { RequestData } from '@sentry/core'; export { LocalVariables } from './local-variables'; export { Undici } from './undici'; diff --git a/packages/node/src/sdk.ts b/packages/node/src/sdk.ts index 00091f6192c7..8a255b5e217a 100644 --- a/packages/node/src/sdk.ts +++ b/packages/node/src/sdk.ts @@ -1,6 +1,8 @@ /* eslint-disable max-lines */ import { - Integrations as CoreIntegrations, + FunctionToString, + InboundFilters, + LinkedErrors, endSession, getClient, getCurrentScope, @@ -38,11 +40,12 @@ import { createGetModuleFromFilename } from './module'; import { makeNodeTransport } from './transports'; import type { NodeClientOptions, NodeOptions } from './types'; +/* eslint-disable deprecation/deprecation */ export const defaultIntegrations = [ // Common - new CoreIntegrations.InboundFilters(), - new CoreIntegrations.FunctionToString(), - new CoreIntegrations.LinkedErrors(), + new InboundFilters(), + new FunctionToString(), + new LinkedErrors(), // Native Wrappers new Console(), new Http(), @@ -57,6 +60,7 @@ export const defaultIntegrations = [ new Modules(), new RequestData(), ]; +/* eslint-enable deprecation/deprecation */ /** * The Sentry Node SDK Client. diff --git a/packages/node/test/index.test.ts b/packages/node/test/index.test.ts index 6add4b35f97f..08f1b7b8f8fe 100644 --- a/packages/node/test/index.test.ts +++ b/packages/node/test/index.test.ts @@ -214,6 +214,7 @@ describe('SentryNode', () => { expect.assertions(15); const options = getDefaultNodeClientOptions({ stackParser: defaultStackParser, + // eslint-disable-next-line deprecation/deprecation integrations: [new ContextLines(), new LinkedErrors()], beforeSend: (event: Event) => { expect(event.exception).not.toBeUndefined(); diff --git a/packages/node/test/integrations/requestdata.test.ts b/packages/node/test/integrations/requestdata.test.ts index 5d7f68f17ca6..e73fe2fbda88 100644 --- a/packages/node/test/integrations/requestdata.test.ts +++ b/packages/node/test/integrations/requestdata.test.ts @@ -21,6 +21,7 @@ const path = '/by/the/trees/'; const queryString = 'chase=me&please=thankyou'; function initWithRequestDataIntegrationOptions(integrationOptions: RequestDataIntegrationOptions): EventProcessor { + // eslint-disable-next-line deprecation/deprecation const requestDataIntegration = new RequestData({ ...integrationOptions, }); diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index d23a8215f76f..1855b2f90593 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -78,6 +78,10 @@ export { startSpanManual, continueTrace, metrics, + functionToStringIntegration, + inboundFiltersIntegration, + linkedErrorsIntegration, + requestDataIntegration, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; @@ -89,6 +93,7 @@ import { Integrations as CoreIntegrations, RequestData } from '@sentry/core'; import { WinterCGFetch } from './integrations/wintercg-fetch'; const INTEGRATIONS = { + // eslint-disable-next-line deprecation/deprecation ...CoreIntegrations, WinterCGFetch, RequestData, diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index 9e85593e4b78..690dfbbe1159 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -1,4 +1,11 @@ -import { Integrations as CoreIntegrations, RequestData, getIntegrationsToSetup, initAndBind } from '@sentry/core'; +import { + FunctionToString, + InboundFilters, + LinkedErrors, + RequestData, + getIntegrationsToSetup, + initAndBind, +} from '@sentry/core'; import type { Integration } from '@sentry/types'; import { GLOBAL_OBJ, createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/utils'; @@ -16,9 +23,11 @@ declare const process: { const nodeStackParser = createStackParser(nodeStackLineParser()); export const defaultIntegrations = [ - new CoreIntegrations.InboundFilters(), - new CoreIntegrations.FunctionToString(), - new CoreIntegrations.LinkedErrors(), + /* eslint-disable deprecation/deprecation */ + new InboundFilters(), + new FunctionToString(), + new LinkedErrors(), + /* eslint-enable deprecation/deprecation */ new WinterCGFetch(), ]; @@ -31,6 +40,7 @@ export function init(options: VercelEdgeOptions = {}): void { // TODO(v8): Add the request data integration by default. // We don't want to add this functionality OOTB without a breaking change because it might contain PII if (options.sendDefaultPii) { + // eslint-disable-next-line deprecation/deprecation sdkDefaultIntegrations.push(new RequestData()); }