feat(react-router): Drop low-quality transactions via ignoreSpans#20514
feat(react-router): Drop low-quality transactions via ignoreSpans#20514nicohrubec wants to merge 7 commits intodevelopfrom
ignoreSpans#20514Conversation
size-limit report 📦
|
ignoreSpans
| return [...getNodeDefaultIntegrations(options), reactRouterServerIntegration()]; | ||
| } | ||
|
|
||
| const LOW_QUALITY_TRANSACTIONS_REGEXES = [ |
There was a problem hiding this comment.
m: Let's not delete the integration, but let's do this inside of the integration, in beforeAllSetup or something like this! This way, users can also opt-out of this behavior, for example. It is also technically breaking to remove an integration like this as users may import it (theoretically...)
There was a problem hiding this comment.
updated to keep the integration and set ignoreSpans in the beforeSetup hook
2d26ee8 to
d4e8438
Compare
d4e8438 to
828583d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3cf652b. Configure here.
| /GET \/node_modules\//, | ||
| /GET \/favicon\.ico/, | ||
| /GET \/@id\//, | ||
| /GET \/__manifest\?/, |
There was a problem hiding this comment.
Bug: The regex /GET \/__manifest\?/ will not match in the streaming path because query strings are stripped from the URL before matching, rendering the filter ineffective.
Severity: MEDIUM
Suggested Fix
Update the regular expression to not expect a query string. Change /GET \/__manifest\?/ to /GET \/__manifest/ to ensure it matches the span description after the query string has been removed.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
packages/react-router/src/server/integration/lowQualityTransactionsFilterIntegration.ts#L9
Potential issue: The regular expression `/GET \/__manifest\?/` is used to filter
low-quality transactions. This expression requires a literal `?` character to match.
However, the logic for the streaming path uses `inferSpanData()`, which strips query
strings and fragments from URLs before the regex is applied. For a request like `GET
/__manifest?p=...`, the description becomes `GET /__manifest`, which will not be matched
by the regex. This causes the filter to silently fail for all transactions processed via
the streaming path, defeating one of the primary goals of the change.
Did we get this right? 👍 / 👎 to inform future reviews.

Migrates the React Router low-quality transactions filter from a dedicated event-processor integration (
lowQualityTransactionsFilterIntegration) toignoreSpansso it also works in the streaming path. Adds some unit tests plus a new e2e test inreact-router-7-frameworkthat asserts no server transaction is sent for filtered/__manifest?requests during client-side navigation (no e2e covered this filter before).Closes #20362