(options: SentryNuxtServerOptions)
| 49 | * Only exported for testing |
| 50 | */ |
| 51 | export 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). |
no test coverage detected