Title: 'cancelled' http.client spans due to Xhr responses being falsely reported as requests · Issue #4427 · getsentry/sentry-javascript · GitHub
Open Graph Title: 'cancelled' http.client spans due to Xhr responses being falsely reported as requests · Issue #4427 · getsentry/sentry-javascript
X Title: 'cancelled' http.client spans due to Xhr responses being falsely reported as requests · Issue #4427 · getsentry/sentry-javascript
Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javascript/releases Provide a link to the aff...
Open Graph Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
X Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/4427
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'cancelled' http.client spans due to Xhr responses being falsely reported as requests","articleBody":"- [x] Review the documentation: https://docs.sentry.io/\r\n- [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues\r\n- [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases\r\n- [x] Provide a link to the affected event from your Sentry account: https://sentry.io/organizations/holistics/performance/holistics-test:1aee0fb08f7d41bba66c77d6413f70ce\r\n\r\n## Package + Version\r\n\r\n- [x] `@sentry/browser`\r\n- [ ] `@sentry/node`\r\n- [ ] `raven-js`\r\n- [ ] `raven-node` _(raven for node)_\r\n- [x] other: `@sentry/vue`, `@sentry/tracing`\r\n\r\n### Version:\r\n\r\n```\r\n6.16.1\r\n```\r\n\r\n## Description\r\nhttp.client spans get marked as 'cancelled' due to Xhr **responses** being falsely reported as **requests**.\r\n\r\nSetup:\r\n* Use `vueRouterInstrumentation`\r\n* Make some xhr requests **before** Vue routing happens (i.e. before 'pageload' transaction has even started).\r\n\r\nActual result:\r\n* If the responses (of the before-vue-routing requests) return after Vue routing, they are recognized as new spans.\r\nConsequently, these spans never receive any further update and eventually get marked as 'cancelled'\r\n\r\nExpected result:\r\n* The responses (of the before-vue-routing requests) get discarded?\r\n\r\nTroubleshooting:\r\n* For every xhr request, [xhrCallBack](https://github.com/getsentry/sentry-javascript/blob/6.16.1/packages/tracing/src/browser/request.ts#L210) is called two times:\r\n 1. When the request is created, to start the `http.client` span\r\n 2. When the request is completed, to finish the `http.client` span\r\n* However, in the first call, Vue routing has not happened and hence instrumentation has not started the 'pageload' transaction yet. Thus, the [execution is halted](https://github.com/getsentry/sentry-javascript/blob/6.16.1/packages/tracing/src/browser/request.ts#L220) and the `http.client` span is not properly initialized. Then, in the second call, `handlerData.xhr.__sentry_xhr_span_id__` is not available, so the xhr request completion is mistaken as a new request creation.\r\n\r\n## Possible fix\r\n* Around https://github.com/getsentry/sentry-javascript/blob/6.16.1/packages/tracing/src/browser/request.ts#L226, do something like `if (handlerData.endTimestamp && !handlerData.xhr.__sentry_xhr_span_id__) return;`?\r\n * Implemented in https://github.com/getsentry/sentry-javascript/pull/4428\r\n\r\n## Update 1\r\n* `fetch` also has the similar issue","author":{"url":"https://github.com/datbth","@type":"Person","name":"datbth"},"datePublished":"2022-01-20T10:45:43Z","url":"https://github.com/getsentry/sentry-javascript/issues/4427"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:580523e5-2c96-b1ed-cec6-f82a688f51aa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F6E:24145A:21598A:2DCE95:6B0451DC |
| html-safe-nonce | 40fadc76e9527884219e7f2b32df7be77ebdb458a50a4d506e6369d77c3675b2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjZFOjI0MTQ1QToyMTU5OEE6MkRDRTk1OjZCMDQ1MURDIiwidmlzaXRvcl9pZCI6IjM4NzI0MzgxMzA0MzA5ODg3NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c6b8381223e4d247de5a7e3e56fff8de851af50a0d36d6f0f532c5329b62775f |
| hovercard-subject-tag | issue:1109142497 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/4427/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e16327bc35f79e6c88bcdeb7e02e49be281de17add15445711ec3f7aa2ace816/getsentry/sentry-javascript/issues/4427 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e16327bc35f79e6c88bcdeb7e02e49be281de17add15445711ec3f7aa2ace816/getsentry/sentry-javascript/issues/4427 |
| og:image:alt | Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | datbth |
| hostname | github.com |
| expected-hostname | github.com |
| None | 910ca0e260cfec6aff11407d8dc6a0d3a4cd381a2ec9ada56627b063426892a0 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e086f9b7e88322eb2b41885a6ad425b215737fa5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width