MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / lowQualityTransactionsFilter

Function lowQualityTransactionsFilter

packages/nuxt/src/server/sdk.ts:51–77  ·  view source on GitHub ↗
(options: SentryNuxtServerOptions)

Source from the content-addressed store, hash-verified

49 * Only exported for testing
50 */
51export function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {
52 return Object.assign(
53 (event => {
54 if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {
55 return event;
56 }
57
58 // Check if this looks like a parametrized route (contains :param or :param() patterns)
59 const hasRouteParameters = /\/:[^(/\s]*(\([^)]*\))?[^/\s]*/.test(event.transaction);
60
61 if (hasRouteParameters) {
62 return event;
63 }
64
65 // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out
66 // path.extname will return an empty string for normal page requests
67 if (path.extname(event.transaction)) {
68 options.debug &&
69 DEBUG_BUILD &&
70 debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);
71 return null;
72 }
73 return event;
74 }) satisfies EventProcessor,
75 { id: 'NuxtLowQualityTransactionsFilter' },
76 );
77}
78
79/**
80 * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).

Callers 2

sdk.test.tsFile · 0.90
initFunction · 0.70

Calls 4

isCacheEventFunction · 0.85
assignMethod · 0.80
testMethod · 0.65
logMethod · 0.65

Tested by

no test coverage detected