Skip to content
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

feat(core): Filter out noisy GoogleTag error by default #11208

Merged
merged 1 commit into from
Mar 20, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const DEFAULT_IGNORE_ERRORS = [
/^Script error\.?$/,
/^Javascript error: Script error\.? on line 0$/,
/^ResizeObserver loop completed with undelivered notifications.$/,
/^Cannot redefine property: googletag$/,
];

/** Options for the InboundFilters integration */
Expand Down
20 changes: 18 additions & 2 deletions packages/core/test/lib/integrations/inboundfilters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ const RESIZEOBSERVER_EVENT: Event = {
},
};

const GOOGLETAG_EVENT: Event = {
exception: {
values: [
{
type: 'TypeError',
value: 'Cannot redefine property: googletag',
},
],
},
};

const MALFORMED_EVENT: Event = {
exception: {
values: [
Expand Down Expand Up @@ -299,16 +310,21 @@ describe('InboundFilters', () => {
expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(null);
});

it('uses default filters', () => {
it('uses default filters (script error)', () => {
const eventProcessor = createInboundFiltersEventProcessor();
expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null);
});

it('uses default filters ResizeObserver', () => {
it('uses default filters (ResizeObserver)', () => {
const eventProcessor = createInboundFiltersEventProcessor();
expect(eventProcessor(RESIZEOBSERVER_EVENT, {})).toBe(null);
});

it('uses default filters (googletag)', () => {
const eventProcessor = createInboundFiltersEventProcessor();
expect(eventProcessor(GOOGLETAG_EVENT, {})).toBe(null);
});

it('filters on last exception when multiple present', () => {
const eventProcessor = createInboundFiltersEventProcessor({
ignoreErrors: ['incorrect type given for parameter `chewToy`'],
Expand Down