Skip to content

ref: Refactor remaining usage of request to normalizedRequest #14401

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

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Nov 21, 2024

This includes exporting httpRequestToRequestEventData from @sentry/node, which we can reuse in a few places.

This also allows us to remove a bunch of stuff from remix, because actually we can just use winterCGRequestToRequestData instead of the custom implementation we have there. at least type wise, this should all work, let's see if any test complains...

Closes #14298

@mydea mydea requested a review from lforst November 21, 2024 08:56
@mydea mydea self-assigned this Nov 21, 2024
@mydea mydea requested a review from onurtemizkan November 21, 2024 08:56
@@ -44,6 +52,9 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial<WrapperOptions>):
const baggage = req.headers?.baggage;

return continueTrace({ sentryTrace, baggage }, () => {
const normalizedRequest = httpRequestToRequestEventData(req);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it is better to set this before we start the span, so we can 100% ensure this is already set for the span.


try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
normalizedRequest = normalizeRemixRequest(request as unknown as any);
normalizedRequest = winterCGRequestToRequestData(request);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know if we need to try-catch this, I am not confident about how the shape of this is 😅 so I left it like this to be on the safe side...

Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful

This includes exporting `httpRequestToRequestEventData` from `@sentry/node`, which we can reuse in a few places.
@mydea mydea force-pushed the fn/more-request-metadata branch from 19d5488 to 2323493 Compare November 21, 2024 09:12
Copy link
Contributor

github-actions bot commented Nov 21, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.86 KB - -
@sentry/browser - with treeshaking flags 21.57 KB - -
@sentry/browser (incl. Tracing) 35.41 KB - -
@sentry/browser (incl. Tracing, Replay) 72.09 KB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.41 KB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 76.39 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 88.87 KB - -
@sentry/browser (incl. Feedback) 39.6 KB - -
@sentry/browser (incl. sendFeedback) 27.5 KB - -
@sentry/browser (incl. FeedbackAsync) 32.3 KB - -
@sentry/react 25.56 KB - -
@sentry/react (incl. Tracing) 38.27 KB - -
@sentry/vue 27.02 KB - -
@sentry/vue (incl. Tracing) 37.23 KB - -
@sentry/svelte 23.01 KB - -
CDN Bundle 24.04 KB - -
CDN Bundle (incl. Tracing) 36.99 KB - -
CDN Bundle (incl. Tracing, Replay) 71.69 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 77.05 KB - -
CDN Bundle - uncompressed 70.89 KB - -
CDN Bundle (incl. Tracing) - uncompressed 110.11 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 222.64 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 235.85 KB - -
@sentry/nextjs (client) 38.38 KB - -
@sentry/sveltekit (client) 35.91 KB - -
@sentry/node 134.46 KB +0.01% +13 B 🔺
@sentry/node - without tracing 96.3 KB +0.02% +18 B 🔺
@sentry/aws-serverless 106.54 KB +0.03% +25 B 🔺

View base workflow run

Copy link

codecov bot commented Nov 21, 2024

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
529 2 527 152
View the top 2 failed tests by shortest run time
server-transactions.test.ts Sends server-side transactions to Sentry
Stack Traces | 0.061s run time
server-transactions.test.ts:4:5 Sends server-side transactions to Sentry
server-errors.test.ts Sends a server-side exception to Sentry
Stack Traces | 0.092s run time
server-errors.test.ts:4:5 Sends a server-side exception to Sentry

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@mydea mydea merged commit 2435b87 into develop Nov 21, 2024
150 of 151 checks passed
@mydea mydea deleted the fn/more-request-metadata branch November 21, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update remaining usage of request on SDK processing metadata
3 participants