-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(browser): Attach virtual stack traces to HttpClient
events.
#14515
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
252e544
to
7597e64
Compare
❌ 29 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
ed1f24d
to
21169f8
Compare
21169f8
to
d58da1c
Compare
@@ -75,6 +85,7 @@ export function instrumentXHR(): void { | |||
endTimestamp: timestampInSeconds() * 1000, | |||
startTimestamp, | |||
xhr: xhrOpenThisArg, | |||
error: httpClientInstrumented ? virtualError : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: Can we just directly attach the stackframe here, instead of passing the error around? then we can maybe just ignore these checks and simply always attach this here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this made it work with ESM builds. Thanks!
05e3351
to
c0b864a
Compare
const virtualError = new Error(); | ||
const virtualStackTrace = virtualError.stack; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is relatively expensive for engines to compute stack traces. I wonder if we could change this a bit so we don't create stack traces every time fetch is called but only when we actually need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, passing a boolean whether the fetch/xhr instrumentations are triggered by HttpClient was flaky because of maybeInstrument
, so passing the error
itself in handler data under virtualError
key (not to conflict with other integrations like Breadcrumbs that use error
key) and creating the stacks inside HttpClient will hopefully give us a slight performance improvement. a7b89bc
c0b864a
to
8929cd3
Compare
8929cd3
to
a7b89bc
Compare
Resolves: #8353
Updated
fetch
andxhr
wrappers to pass virtual errors to theHttpClient
integration so we can group the events with the stack traces.It seems we can't create the virtual errors inside the
HttpClient
integration, as we're losing the non-Sentry frames.Sampled fetch event - Link
Sampled XHR event - Link