Skip to content
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

fix(web-vitals): Fix TTFB capture in Safari #3106

Merged
merged 3 commits into from
Dec 8, 2020
Merged

fix(web-vitals): Fix TTFB capture in Safari #3106

merged 3 commits into from
Dec 8, 2020

Conversation

dashed
Copy link
Member

@dashed dashed commented Dec 7, 2020

Safari doesn't support performance.timeOrigin https://developer.mozilla.org/en-US/docs/Web/API/Performance/timeOrigin

This regression was introduced in #3019

As a result, this caused TTFB captures to be null when normalized with respect to transaction.startTime:

Screen Shot 2020-12-07 at 4 09 17 PM


When using the timeOrigin polyfill (i.e. browserPerformanceTimeOrigin), the numbers propagate properly. Unfortunately, this may cause normalized TTFB values to be negative.
Screen Shot 2020-12-07 at 4 00 38 PM

We simply take its absolute value:

Screen Shot 2020-12-07 at 4 02 44 PM


In addition, I've updated the getTTFB() implementation to the latest web-vitals revision: https://github.com/GoogleChrome/web-vitals/blob/eef03ad99882b6cdb6e35eee4c2d9b220152ed0a/src/getTTFB.ts

@dashed dashed requested review from a team December 7, 2020 21:15
@dashed dashed self-assigned this Dec 7, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2020

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 19.73 KB (-0.01% 🔽)
@sentry/browser - Webpack 20.6 KB (0%)
@sentry/react - Webpack 20.6 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 26.88 KB (-0.01% 🔽)

@dashed dashed merged commit 4a0e964 into master Dec 8, 2020
@dashed dashed deleted the fix-ttfb-safari branch December 8, 2020 17:12
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.

None yet

2 participants