-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(integrations): Add HTTPClient integration #6500
Conversation
size-limit report 📦
|
9f40a03
to
0eb8748
Compare
0eb8748
to
3bbc564
Compare
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.
First pass. Already looks very good to me!
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.
One more pass, after this I think we're good :)
we need to discuss this bundle size bump and why it is so much on the CDN, if we can get a strategy to reduce it |
@onurtemizkan I completely missed the bundle size impact. Can we move this integration into the |
523ede7
to
e8fb9cd
Compare
Resolves: #6282
Implemented
HTTPClient
integration for@sentry/browser
SDK.Implementation Guide
Response Context Spec
This integration intercepts Fetch API and XHR requests to get the response (and request) information, and creates / captures events if there is a failed (according to the user's configuration) request.
Summary:
XMLHttpRequest
andfetch
utilities, which can also be wrapped by other Sentry - non-Sentry utilities before or after it.cookie
andheader
collection for bothrequest
s andresponse
s is the best effort. Certain headers may be missing here in the integration-created event, even if they exist in the original request / response.body_size
is calculated only if theContent-Length
header is available in response headers.fetch
-specific Notes:body
insideevent.request
object is not implemented here. It's not available at all for XHR requests, but here it's possible. Size limits and when to leave it out should be discussed, if we are including it.Request
object from arguments of thefetch
function. Not sure if there are any concerns about performance, but this is the most straightforward way I could find to replicate the originalrequest
object.request
and nativeresponse
objects are added to the event ashint
s, as described in the spec.XHR
-specific Notes:XHR
requests. We're interceptingsetRequestHeader
method, which is only used for user or library-defined headers. And settingCookie
withsetRequestHeader
is not allowed in browsers. due to security reasons.request
andresponse
objects forXHR
requests, so events created from failed XHR requests, do not contain hints.