Title: replay: trimming network responses results block main thread · Issue #9426 · getsentry/sentry-javascript · GitHub
Open Graph Title: replay: trimming network responses results block main thread · Issue #9426 · getsentry/sentry-javascript
X Title: replay: trimming network responses results block main thread · Issue #9426 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/9426
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"replay: trimming network responses results block main thread","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/react\n\n### SDK Version\n\n7.75.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### SDK Setup\n\n_No response_\n\n### Steps to Reproduce\n\nSet up env using replay, enable request body logging, and fetch a response exceeding max body length.\r\n\r\n\r\n\r\nI did a very surface investigation of this, but the issue comes from the fact that replay defines max response body size as 150kB, trims any responses that exceed it, and rebuilds the JSON to again be valid. This seems to all be done synchronously on the client side. This means that the parser rebuilding the JSON will run 150k iterations as it iterates over each char and maintains the matching bracket stack, which is probably enough to cause jank on its own, but I suspect a large part of why this is so slow is because [_evaluateJsonPos](https://github.com/getsentry/sentry-javascript/blob/b2a56bcc72185b626c19e290a614bc61710fe190/packages/replay/src/util/truncateJson/evaluateJson.ts#L33) runs a regexp on each char.\r\n\r\nWe should look into doing this more efficiently by either workerizing it or reconstructing the JSON on the server.\n\n### Expected Result\n\nReplay should not cause jank\n\n### Actual Result\n\nJank","author":{"url":"https://github.com/JonasBa","@type":"Person","name":"JonasBa"},"datePublished":"2023-11-01T13:51:06Z","url":"https://github.com/getsentry/sentry-javascript/issues/9426"}
| 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:672c9594-fa3c-11d6-0a99-dd79a7f27949 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B8C4:31EC7:4DA2A5:6C4EBC:6B044486 |
| html-safe-nonce | 7678a0a0912e7af0c1af67c19c5ac4b811ccd179b70a2a6721f70eae97471a0d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEM0OjMxRUM3OjREQTJBNTo2QzRFQkM6NkIwNDQ0ODYiLCJ2aXNpdG9yX2lkIjoiMTU1ODcwMDAwNDk1OTYwMTc5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f7cec92eeb726adc201c2a903bbeaacf552f2aacfd1ef4214a4d5dce1edcae3b |
| hovercard-subject-tag | issue:1972421774 |
| 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/9426/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4455e84be1a3a7e0ab7a0226374e49b7371b12dcbf7db221c02ad185e66a0931/getsentry/sentry-javascript/issues/9426 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4455e84be1a3a7e0ab7a0226374e49b7371b12dcbf7db221c02ad185e66a0931/getsentry/sentry-javascript/issues/9426 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JonasBa |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| 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 | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| 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