-
-
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
[Improvement] breadcrumbCallback - allow to capture more XHR data than method and url #1490
Comments
It'll be possible in the next major release, which is scheduled for the second part of Q3 :) |
It's doable through breadcrumb hints in the new SDK now. init({
dsn: 'https://some.dsn/123',
beforeBreadcrumb (breadcrumb, hint) {
if (breadcrumb.category === 'xhr') {
// hint.xhr is a whole XHR object that you can use to modify breadcrumb
}
return breadcrumb;
}
}) |
@kamilogorek In which SDK exactly this option is available? Just upgraded raven-js to 3.27.0 and this option does not work ( |
aka Also please see #1401 (comment) |
Hi @kamilogorek Is there any limit for the size of a breadcrumb? I tried as test to include the whole response (that I'm getting from XHR object after GraphQL request) in a breadcrumb, using mentioned Do you have any idea, what could be the cause of that? |
@filipows yes, there's a hard limit of 200kB for a whole event sent to Sentry. https://docs.sentry.io/clients/javascript/usage/?platform=browser
|
Thank you @kamilogorek ! You've probably just saved me a lot of time 😄 It might be worth adding it as a note in the docs under current Ps. I've just noticed interesting thing, that the same payload in Chrome is being blocked (request stays "pending"), whilst the same one from Firefox is successful with HTTP 200 response. In both situations the payload size was 143kB. |
@filipows sent a PR - getsentry/sentry-docs#470 :) |
@filipows also see this: https://github.com/getsentry/sentry-docs/pull/310/files#diff-1412e3df3283d554d6037ceef9fe1c80R302 (probable cause of this difference) |
When using typescript - is it possilbe to get types for the update |
Current behaviour
Only method and url of XHR are captured, and those are only data available inside breadcrumbCallback.
Expected behaviour
All XHR data (such as request body and headers) should be available inside breadcrumbCallback (though not all captured by sentry by default).
Use case
When using GraphQL api I end up with all XHR breadcrumbs look same like this:
xhr | POST https://api.myapp.com/graphql [200]
xhr | POST https://api.myapp.com/graphql [200]
xhr | POST https://api.myapp.com/graphql [200]
...
xhr | POST https://api.myapp.com/graphql [200]
Would be nice to be able to also capture GraphQL query name for example.
It's not possible right now since request body is not available inside breadcrumbCallback.
The text was updated successfully, but these errors were encountered: