Skip to content

Conversation

@mydea
Copy link
Member

@mydea mydea commented Oct 24, 2023

We've been using the wrong startTimestamp for the core xhr instrumentation. Outside of replay, this wasn't noticed because we are not actually using the anywhere 😬 But in replay, it lead to all xhr breadrcumbs showing an incorrect duration of 0.

Note that this is maybe not 100% correct, as in theory you could call xhr.send() later, which is probably the most correct start timestamp. But this would require us to keep the start time somewhere on the xhr object, which is a bit trickier than this solution. So I think it is fine to do this based on xhr.open() (and definitely more correct than it was before).

fixes getsentry/sentry#52790

@mydea mydea requested review from Lms24, billyvg and lforst October 24, 2023 07:24
@mydea mydea self-assigned this Oct 24, 2023
@mydea mydea changed the title fix(utils): Fix xhr start timestamps fix(replay): Fix xhr start timestamps Oct 24, 2023
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and definitely more correct than it was before

Agreed!

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 82.52 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 71.66 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 30.65 KB (+0.04% 🔺)
@sentry/browser - Webpack (gzipped) 21.25 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 73.03 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.7 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 21.09 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 233.78 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 87.1 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 62.73 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.46 KB (+0.03% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 82.98 KB (+0.02% 🔺)
@sentry/react - Webpack (gzipped) 21.29 KB (+0.06% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 99.39 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 47.55 KB (+0.02% 🔺)

@mydea mydea merged commit 921b8df into develop Oct 24, 2023
@mydea mydea deleted the fn/fix-xhr-timestamp branch October 24, 2023 08:00
@damacisaac
Copy link

appreciate the fix - nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duration is always 0 for network requests to 1st party domain in Sentry Replays

5 participants