Skip to content

Commit eded722

Browse files
authored
fix(core): Narrow filters for health check transactions (#9257)
Narrows down the regexes so that they no longer only require a partial but a full match for a given transaction.
1 parent 43ed7b0 commit eded722

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/core/src/integrations/inboundfilters.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { getEventDescription, logger, stringMatchesSomePattern } from '@sentry/u
66
const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
77

88
const DEFAULT_IGNORE_TRANSACTIONS = [
9-
/^.*healthcheck.*$/,
10-
/^.*healthy.*$/,
11-
/^.*live.*$/,
12-
/^.*ready.*$/,
13-
/^.*heartbeat.*$/,
9+
/^.*\/healthcheck$/,
10+
/^.*\/healthy$/,
11+
/^.*\/live$/,
12+
/^.*\/ready$/,
13+
/^.*\/heartbeat$/,
1414
/^.*\/health$/,
1515
/^.*\/healthz$/,
1616
];

packages/core/test/lib/integrations/inboundfilters.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,18 @@ describe('InboundFilters', () => {
428428
expect(eventProcessor(TRANSACTION_EVENT_HEALTH_2, {})).toBe(TRANSACTION_EVENT_HEALTH_2);
429429
expect(eventProcessor(TRANSACTION_EVENT_HEALTH_3, {})).toBe(TRANSACTION_EVENT_HEALTH_3);
430430
});
431+
432+
it.each(['/delivery', '/already', '/healthysnacks'])(
433+
"doesn't filter out transactions that have similar names to health check ones (%s)",
434+
transaction => {
435+
const eventProcessor = createInboundFiltersEventProcessor();
436+
const evt: Event = {
437+
transaction,
438+
type: 'transaction',
439+
};
440+
expect(eventProcessor(evt, {})).toBe(evt);
441+
},
442+
);
431443
});
432444

433445
describe('denyUrls/allowUrls', () => {

0 commit comments

Comments
 (0)