diff --git a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js index 64e5af159cb0..a02b77c89b49 100644 --- a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js +++ b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js @@ -6,7 +6,7 @@ import { defaultStackParser, functionToStringIntegration, httpContextIntegration, - inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, makeFetchTransport, } from '@sentry/browser'; @@ -16,7 +16,7 @@ const integrations = [ functionToStringIntegration(), dedupeIntegration(), httpContextIntegration(), - inboundFiltersIntegration(), + eventFiltersIntegration(), linkedErrorsIntegration(), ]; diff --git a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts index 642006f4c2fc..e77b0cfd3729 100644 --- a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts +++ b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts @@ -38,7 +38,7 @@ sentryTest('allows to setup a client manually & capture exceptions', async ({ ge environment: 'local', release: '0.0.1', sdk: { - integrations: ['Breadcrumbs', 'FunctionToString', 'Dedupe', 'HttpContext', 'InboundFilters', 'LinkedErrors'], + integrations: ['Breadcrumbs', 'FunctionToString', 'Dedupe', 'HttpContext', 'EventFilters', 'LinkedErrors'], name: 'sentry.javascript.browser', version: expect.any(String), packages: [{ name: expect.any(String), version: expect.any(String) }], diff --git a/packages/angular/src/sdk.ts b/packages/angular/src/sdk.ts index 404305f770ff..9752db9cc384 100755 --- a/packages/angular/src/sdk.ts +++ b/packages/angular/src/sdk.ts @@ -33,6 +33,8 @@ export function getDefaultIntegrations(_options: BrowserOptions = {}): Integrati // - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097 // - https://github.com/getsentry/sentry-javascript/issues/2744 return [ + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), breadcrumbsIntegration(), diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index c7b997c2cb92..6f9647d0134e 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -58,7 +58,9 @@ export { graphqlIntegration, hapiIntegration, httpIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, initOpenTelemetry, isInitialized, kafkaIntegration, diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 2cd5ee5661ec..51848530712b 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -54,7 +54,9 @@ export { localVariablesIntegration, requestDataIntegration, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index ae7adf8bd383..8745e34106f4 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -49,7 +49,9 @@ export { withScope, withIsolationScope, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, dedupeIntegration, parameterize, startSession, diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index d91f62d1ec47..1c7e6fbe95ad 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -34,6 +34,8 @@ export function getDefaultIntegrations(_options: Options): Integration[] { * `getDefaultIntegrations` but with an adjusted set of integrations. */ return [ + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), browserApiErrorsIntegration(), diff --git a/packages/browser/test/index.test.ts b/packages/browser/test/index.test.ts index c0e79481788b..815dd39707f9 100644 --- a/packages/browser/test/index.test.ts +++ b/packages/browser/test/index.test.ts @@ -7,10 +7,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { SDK_VERSION, + eventFiltersIntegration, getGlobalScope, getIsolationScope, getReportDialogEndpoint, - inboundFiltersIntegration, lastEventId, } from '@sentry/core'; import * as utils from '@sentry/core'; @@ -304,12 +304,12 @@ describe('SentryBrowser', () => { expect(localBeforeSend).toHaveBeenCalledTimes(2); }); - it('should use inboundfilter rules of bound client', async () => { + it('should use eventFilters rules of bound client', async () => { const localBeforeSend = vi.fn(); const options = getDefaultBrowserClientOptions({ beforeSend: localBeforeSend, dsn, - integrations: [inboundFiltersIntegration({ ignoreErrors: ['capture'] })], + integrations: [eventFiltersIntegration({ ignoreErrors: ['capture'] })], }); const client = new BrowserClient(options); setCurrentClient(client); diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index c25c65487a47..52b3d9fa4c42 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -74,7 +74,9 @@ export { requestDataIntegration, fsIntegration, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, diff --git a/packages/bun/src/sdk.ts b/packages/bun/src/sdk.ts index 96f1b63f902d..6c56a66aecea 100644 --- a/packages/bun/src/sdk.ts +++ b/packages/bun/src/sdk.ts @@ -29,6 +29,8 @@ export function getDefaultIntegrations(_options: Options): Integration[] { // We return a copy of the defaultIntegrations here to avoid mutating this return [ // Common + // TODO(v10): Replace with eventFiltersIntegration once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), linkedErrorsIntegration(), diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 2aedf4362aea..cd3dda5924ec 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -65,7 +65,9 @@ export { getSpanDescendants, continueTrace, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, diff --git a/packages/cloudflare/src/sdk.ts b/packages/cloudflare/src/sdk.ts index 89f3fe99d050..9891994e8de1 100644 --- a/packages/cloudflare/src/sdk.ts +++ b/packages/cloudflare/src/sdk.ts @@ -20,6 +20,8 @@ export function getDefaultIntegrations(options: CloudflareOptions): Integration[ const sendDefaultPii = options.sendDefaultPii ?? false; return [ dedupeIntegration(), + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), linkedErrorsIntegration(), diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 097a4ef6a69d..35bfc35bc603 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -96,7 +96,9 @@ export { export { DEFAULT_ENVIRONMENT } from './constants'; export { addBreadcrumb } from './breadcrumbs'; export { functionToStringIntegration } from './integrations/functiontostring'; -export { inboundFiltersIntegration } from './integrations/inboundfilters'; +// eslint-disable-next-line deprecation/deprecation +export { inboundFiltersIntegration } from './integrations/eventFilters'; +export { eventFiltersIntegration } from './integrations/eventFilters'; export { linkedErrorsIntegration } from './integrations/linkederrors'; export { moduleMetadataIntegration } from './integrations/metadata'; export { requestDataIntegration } from './integrations/requestdata'; diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/eventFilters.ts similarity index 76% rename from packages/core/src/integrations/inboundfilters.ts rename to packages/core/src/integrations/eventFilters.ts index 7840ab5f6920..087623367e28 100644 --- a/packages/core/src/integrations/inboundfilters.ts +++ b/packages/core/src/integrations/eventFilters.ts @@ -23,8 +23,8 @@ const DEFAULT_IGNORE_ERRORS = [ /^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065) ]; -/** Options for the InboundFilters integration */ -export interface InboundFiltersOptions { +/** Options for the EventFilters integration */ +export interface EventFiltersOptions { allowUrls: Array; denyUrls: Array; ignoreErrors: Array; @@ -33,8 +33,9 @@ export interface InboundFiltersOptions { disableErrorDefaults: boolean; } -const INTEGRATION_NAME = 'InboundFilters'; -const _inboundFiltersIntegration = ((options: Partial = {}) => { +const INTEGRATION_NAME = 'EventFilters'; + +const _eventFiltersIntegration = ((options: Partial = {}) => { return { name: INTEGRATION_NAME, processEvent(event, _hint, client) { @@ -45,12 +46,48 @@ const _inboundFiltersIntegration = ((options: Partial = { }; }) satisfies IntegrationFn; -export const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration); +/** + * An integration that filters out events (errors and transactions) based on: + * + * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS}) + * - (Errors) A list of error messages or urls/filenames passed in via + * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`) + * - The same options passed to the integration directly via @param options + * - (Transactions/Spans) A list of root span (transaction) names passed in via + * - Top level Sentry.init option (`ignoreTransactions`) + * - The same option passed to the integration directly via @param options + * + * Events filtered by this integration will not be sent to Sentry. + */ +export const eventFiltersIntegration = defineIntegration(_eventFiltersIntegration); + +/** + * An integration that filters out events (errors and transactions) based on: + * + * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS}) + * - (Errors) A list of error messages or urls/filenames passed in via + * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`) + * - The same options passed to the integration directly via @param options + * - (Transactions/Spans) A list of root span (transaction) names passed in via + * - Top level Sentry.init option (`ignoreTransactions`) + * - The same option passed to the integration directly via @param options + * + * Events filtered by this integration will not be sent to Sentry. + * + * @deprecated this integration was renamed and will be removed in a future major version. + * Use `eventFiltersIntegration` instead. + */ +export const inboundFiltersIntegration = defineIntegration(((options: Partial = {}) => { + return { + ...eventFiltersIntegration(options), + name: 'InboundFilters', + }; +}) satisfies IntegrationFn); function _mergeOptions( - internalOptions: Partial = {}, - clientOptions: Partial = {}, -): Partial { + internalOptions: Partial = {}, + clientOptions: Partial = {}, +): Partial { return { allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])], denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])], @@ -64,7 +101,7 @@ function _mergeOptions( }; } -function _shouldDropEvent(event: Event, options: Partial): boolean { +function _shouldDropEvent(event: Event, options: Partial): boolean { if (options.ignoreInternal && _isSentryError(event)) { DEBUG_BUILD && logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${getEventDescription(event)}`); diff --git a/packages/core/test/lib/integrations/inboundfilters.test.ts b/packages/core/test/lib/integrations/eventFilters.test.ts similarity index 76% rename from packages/core/test/lib/integrations/inboundfilters.test.ts rename to packages/core/test/lib/integrations/eventFilters.test.ts index d70a17a81bc7..b89f0f97a8e7 100644 --- a/packages/core/test/lib/integrations/inboundfilters.test.ts +++ b/packages/core/test/lib/integrations/eventFilters.test.ts @@ -1,23 +1,24 @@ -import type { Event, EventProcessor } from '../../../src/types-hoist'; +import type { Event, EventProcessor, Integration } from '../../../src/types-hoist'; import { describe, expect, it } from 'vitest'; -import type { InboundFiltersOptions } from '../../../src/integrations/inboundfilters'; -import { inboundFiltersIntegration } from '../../../src/integrations/inboundfilters'; +import type { EventFiltersOptions } from '../../../src/integrations/eventFilters'; +import { eventFiltersIntegration } from '../../../src/integrations/eventFilters'; +import { inboundFiltersIntegration } from '../../../src/integrations/eventFilters'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; const PUBLIC_DSN = 'https://username@domain/123'; /** - * Creates an instance of the InboundFilters integration and returns - * the event processor that the InboundFilters integration creates. + * Creates an instance of the eventFiltersIntegration and returns + * the event processor that the eventFiltersIntegration creates. * - * To test the InboundFilters integration, call this function and assert on + * To test the eventFiltersIntegration, call this function and assert on * how the event processor handles an event. For example, if you set up the - * InboundFilters to filter out an SOME_EXCEPTION_EVENT. + * event filters to filter out an SOME_EXCEPTION_EVENT. * * ``` * // some options that cause SOME_EXCEPTION_EVENT to be filtered - * const eventProcessor = createInboundFiltersEventProcessor(options); + * const eventProcessor = eventFiltersIntegration(options); * * expect(eventProcessor(SOME_EXCEPTION_EVENT)).toBe(null); * ``` @@ -25,23 +26,27 @@ const PUBLIC_DSN = 'https://username@domain/123'; * @param options options passed into the InboundFilters integration * @param clientOptions options passed into the mock Sentry client */ -function createInboundFiltersEventProcessor( - options: Partial = {}, - clientOptions: Partial = {}, +function createEventFiltersEventProcessor( + integrationFn: (opts: Partial) => Integration, + options: Partial = {}, + clientOptions: Partial = {}, ): EventProcessor { + const integration = integrationFn(options); + const client = new TestClient( getDefaultTestClientOptions({ dsn: PUBLIC_DSN, ...clientOptions, defaultIntegrations: false, - integrations: [inboundFiltersIntegration(options)], + // eslint-disable-next-line deprecation/deprecation + integrations: [integration], }), ); client.init(); const eventProcessors = client['_eventProcessors']; - const eventProcessor = eventProcessors.find(processor => processor.id === 'InboundFilters'); + const eventProcessor = eventProcessors.find(processor => processor.id === integration.name); expect(eventProcessor).toBeDefined(); return eventProcessor!; @@ -327,17 +332,21 @@ const TRANSACTION_EVENT_3: Event = { type: 'transaction', }; -describe('InboundFilters', () => { +describe.each([ + // eslint-disable-next-line deprecation/deprecation + ['InboundFilters', inboundFiltersIntegration], + ['EventFilters', eventFiltersIntegration], +])('%s', (_, integrationFn) => { describe('_isSentryError', () => { it('should work as expected', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(MESSAGE_EVENT); expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(EXCEPTION_EVENT); expect(eventProcessor(SENTRY_EVENT, {})).toBe(null); }); it('should be configurable', () => { - const eventProcessor = createInboundFiltersEventProcessor({ ignoreInternal: false }); + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreInternal: false }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(MESSAGE_EVENT); expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(EXCEPTION_EVENT); expect(eventProcessor(SENTRY_EVENT, {})).toBe(SENTRY_EVENT); @@ -346,35 +355,35 @@ describe('InboundFilters', () => { describe('ignoreErrors', () => { it('string filter with partial match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['capture'], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); }); it('ignores transaction event for filtering', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['transaction'], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(TRANSACTION_EVENT); }); it('string filter with exact match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['captureMessage'], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); }); it('regexp filter with partial match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/capture/], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); }); it('regexp filter with exact match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/^captureMessage$/], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); @@ -382,7 +391,7 @@ describe('InboundFilters', () => { }); it('prefers message when both message and exception are available', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/captureMessage/], }); const event = { @@ -393,7 +402,7 @@ describe('InboundFilters', () => { }); it('can use multiple filters', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['captureMessage', /SyntaxError/], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); @@ -401,44 +410,44 @@ describe('InboundFilters', () => { }); it('uses default filters (script error)', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null); }); it('uses default filters (ResizeObserver)', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(RESIZEOBSERVER_EVENT, {})).toBe(null); }); it('uses default filters (googletag)', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(GOOGLETAG_EVENT, {})).toBe(null); }); it('uses default filters (Google App "gmo")', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(GOOGLE_APP_GMO, {})).toBe(null); }); it('uses default filters (CEFSharp)', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(CEFSHARP_EVENT, {})).toBe(null); }); it('uses default filters (FB Mobile Browser)', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(FB_MOBILE_BROWSER_EVENT, {})).toBe(null); }); it('filters on last exception when multiple present', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['incorrect type given for parameter `chewToy`'], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_LINKED_ERRORS, {})).toBe(null); }); it("doesn't filter on `cause` exception when multiple present", () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['`tooManyTreats` is not defined'], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_LINKED_ERRORS, {})).toBe(EXCEPTION_EVENT_WITH_LINKED_ERRORS); @@ -446,31 +455,31 @@ describe('InboundFilters', () => { describe('on exception', () => { it('uses exception data when message is unavailable', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: ['SyntaxError: unidentified ? at line 1337'], }); expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(null); }); it('can match on exception value', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/unidentified \?/], }); expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(null); }); it('can match on exception type', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/^SyntaxError/], }); expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(null); }); it('should consider both `event.message` and the last exceptions `type` and `value`', () => { - const messageEventProcessor = createInboundFiltersEventProcessor({ + const messageEventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/^ChunkError/], }); - const valueEventProcessor = createInboundFiltersEventProcessor({ + const valueEventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreErrors: [/^SyntaxError/], }); expect(messageEventProcessor(EXCEPTION_EVENT_WITH_MESSAGE_AND_VALUE, {})).toBe(null); @@ -481,35 +490,35 @@ describe('InboundFilters', () => { describe('ignoreTransactions', () => { it('string filter with partial match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: ['name'], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(null); }); it('ignores error event for filtering', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: ['capture'], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(MESSAGE_EVENT); }); it('string filter with exact match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: ['transaction name'], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(null); }); it('regexp filter with partial match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: [/name/], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(null); }); it('regexp filter with exact match', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: [/^transaction name$/], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(null); @@ -517,7 +526,7 @@ describe('InboundFilters', () => { }); it('can use multiple filters', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { ignoreTransactions: ['transaction name 2', /transaction/], }); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(null); @@ -526,27 +535,27 @@ describe('InboundFilters', () => { }); it('uses default filters', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null); expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(TRANSACTION_EVENT); }); it('disable default error filters', () => { - const eventProcessor = createInboundFiltersEventProcessor({ disableErrorDefaults: true }); + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { disableErrorDefaults: true }); expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(SCRIPT_ERROR_EVENT); }); }); describe('denyUrls/allowUrls', () => { it('should filter captured message based on its stack trace using string filter', () => { - const eventProcessorDeny = createInboundFiltersEventProcessor({ + const eventProcessorDeny = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io'], }); expect(eventProcessorDeny(MESSAGE_EVENT_WITH_STACKTRACE, {})).toBe(null); }); it('should allow denyUrls to take precedence', () => { - const eventProcessorBoth = createInboundFiltersEventProcessor({ + const eventProcessorBoth = createEventFiltersEventProcessor(integrationFn, { allowUrls: ['https://awesome-analytics.io'], denyUrls: ['https://awesome-analytics.io'], }); @@ -554,63 +563,63 @@ describe('InboundFilters', () => { }); it('should filter captured message based on its stack trace using regexp filter', () => { - const eventProcessorDeny = createInboundFiltersEventProcessor({ + const eventProcessorDeny = createEventFiltersEventProcessor(integrationFn, { denyUrls: [/awesome-analytics\.io/], }); expect(eventProcessorDeny(MESSAGE_EVENT_WITH_STACKTRACE, {})).toBe(null); }); it('should not filter captured messages with no stacktraces', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io'], }); expect(eventProcessor(MESSAGE_EVENT, {})).toBe(MESSAGE_EVENT); }); it('should filter captured exception based on its stack trace using string filter', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io'], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_FRAMES, {})).toBe(null); }); it('should filter captured exception based on its stack trace using regexp filter', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: [/awesome-analytics\.io/], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_FRAMES, {})).toBe(null); }); it("should not filter events that don't match the filtered values", () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['some-other-domain.com'], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_FRAMES, {})).toBe(EXCEPTION_EVENT_WITH_FRAMES); }); it('should be able to use multiple filters', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['some-other-domain.com', /awesome-analytics\.io/], }); expect(eventProcessor(EXCEPTION_EVENT_WITH_FRAMES, {})).toBe(null); }); it('should not fail with malformed event event', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io'], }); expect(eventProcessor(MALFORMED_EVENT, {})).toBe(MALFORMED_EVENT); }); it('should search for script names when there is an anonymous callback at the last frame', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io/some/file.js'], }); expect(eventProcessor(MESSAGE_EVENT_WITH_ANON_LAST_FRAME, {})).toBe(null); }); it('should search for script names when the last frame is from native code', () => { - const eventProcessor = createInboundFiltersEventProcessor({ + const eventProcessor = createEventFiltersEventProcessor(integrationFn, { denyUrls: ['https://awesome-analytics.io/some/file.js'], }); expect(eventProcessor(MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME, {})).toBe(null); @@ -619,32 +628,32 @@ describe('InboundFilters', () => { describe('useless errors', () => { it("should drop event with exceptions that don't have any message, type or stack trace", () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(USELESS_EXCEPTION_EVENT, {})).toBe(null); }); it('should drop event with just a generic error without stacktrace or message', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(USELESS_ERROR_EXCEPTION_EVENT, {})).toBe(null); }); it('should not drop event with a message', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(EVENT_WITH_MESSAGE, {})).toBe(EVENT_WITH_MESSAGE); }); it('should not drop event with an exception that has a type', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(EVENT_WITH_TYPE, {})).toBe(EVENT_WITH_TYPE); }); it('should not drop event with an exception that has a stacktrace', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(EVENT_WITH_STACKTRACE, {})).toBe(EVENT_WITH_STACKTRACE); }); it('should not drop event with an exception that has a value', () => { - const eventProcessor = createInboundFiltersEventProcessor(); + const eventProcessor = createEventFiltersEventProcessor(integrationFn); expect(eventProcessor(EVENT_WITH_VALUE, {})).toBe(EVENT_WITH_VALUE); }); }); diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 129f4f1a765e..a906197b40c2 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -61,7 +61,9 @@ export { startSpanManual, startNewTrace, suppressTracing, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, functionToStringIntegration, requestDataIntegration, diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 25dc550fc353..588d417f5ed9 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -24,6 +24,8 @@ export function getDefaultIntegrations(_options: Options): Integration[] { // We return a copy of the defaultIntegrations here to avoid mutating this return [ // Common + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), linkedErrorsIntegration(), diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index 4d7c23ecf87e..9505ef6dd248 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -55,7 +55,9 @@ export { requestDataIntegration, fsIntegration, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 2ebb7445a817..bdc8d6405217 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -75,7 +75,9 @@ export { withMonitor, requestDataIntegration, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, diff --git a/packages/node/src/sdk/index.ts b/packages/node/src/sdk/index.ts index 7b9f98ed7461..710e00a3452b 100644 --- a/packages/node/src/sdk/index.ts +++ b/packages/node/src/sdk/index.ts @@ -51,6 +51,8 @@ function getCjsOnlyIntegrations(): Integration[] { export function getDefaultIntegrationsWithoutPerformance(): Integration[] { return [ // Common + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), linkedErrorsIntegration(), diff --git a/packages/remix/src/cloudflare/index.ts b/packages/remix/src/cloudflare/index.ts index c86548a39aee..4634baa1381e 100644 --- a/packages/remix/src/cloudflare/index.ts +++ b/packages/remix/src/cloudflare/index.ts @@ -82,6 +82,7 @@ export { getSpanDescendants, continueTrace, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index 44c616de3a30..4160a871d165 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -47,7 +47,9 @@ export { graphqlIntegration, hapiIntegration, httpIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, initOpenTelemetry, isInitialized, knexIntegration, diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index a6362af1c7f4..948c3c746d0c 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -50,7 +50,9 @@ export { graphqlIntegration, hapiIntegration, httpIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, initOpenTelemetry, isInitialized, knexIntegration, diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index ccd09570b674..f8844c1e264d 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -52,7 +52,9 @@ export { graphqlIntegration, hapiIntegration, httpIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, initOpenTelemetry, isInitialized, knexIntegration, diff --git a/packages/sveltekit/src/worker/index.ts b/packages/sveltekit/src/worker/index.ts index a74989b7d28e..8e0e549440ca 100644 --- a/packages/sveltekit/src/worker/index.ts +++ b/packages/sveltekit/src/worker/index.ts @@ -43,6 +43,7 @@ export { getSpanStatusFromHttpCode, getTraceData, getTraceMetaTags, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, isInitialized, lastEventId, diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index 560f06e00e44..eb6429c441fa 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -65,7 +65,9 @@ export { getSpanDescendants, continueTrace, functionToStringIntegration, + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration, + eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index a816b02e27a9..efb3a8dfcd0c 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -51,6 +51,8 @@ const nodeStackParser = createStackParser(nodeStackLineParser()); export function getDefaultIntegrations(options: Options): Integration[] { return [ dedupeIntegration(), + // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` + // eslint-disable-next-line deprecation/deprecation inboundFiltersIntegration(), functionToStringIntegration(), linkedErrorsIntegration(),