question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Measure relative to fetchStart?

See original GitHub issue

My application is behind authentication which is handled via redirects to another domain outside my control. I’ve implemented logging of navigation and paint timing metrics recently and noticed the redirect time introduces significant variance in the data (depending on if a redirect for auth was needed or not).

Looking at the Navigation timing model, it also seems inappropriate to include unload time from the previous site because that is out of my app’s control.

Based on this I adjusted our perf measurements to be relative to the fetchStart instead of startTime.

I wanted to get your team’s input - does this seem like a reasonable thing to do for performance metrics? or am I missing some value here?

Maybe this could be added as an option to this lib.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
deasemscommented, May 8, 2020

Thanks for the guidance @philipwalton

1reaction
philipwaltoncommented, May 7, 2020

Yes, the web APIs all measure relative to the time origin, which includes unload, DNS, connection, etc.

Unless you think this pattern is viable? not sure if some of these metrics would get missed by waiting for TTFB to fire first.

getTTFB(metric => {
  const timingOffset = metric.entries[0].fetchStart;
  getFCP(fcp => {
    log(fcp.value - timingOffset);
  });
  getLCP(...)
  ...
});

That would work, though I’d strongly encourage you to at minimum track both versions of the metric, or track them separately so you could do the math on the back end but still report both values.

I’d also encourage you to call the metrics by a different name of you’re going to change their definition. Otherwise it could lead to confusion if you were going to compare those scores to the scores reported by other Google tools (and keep in mind that within Chrome, these values are always measured relative to the time origin).

Read more comments on GitHub >

github_iconTop Results From Across the Web

PerformanceResourceTiming.fetchStart - Web APIs | MDN
The fetchStart and responseEnd properties can be used to measure the overall time it took to fetch the final resource (without redirects).
Read more >
What is an accurate measure for time to first byte?
If you do fetchStart, you'll just be measuring the time from when the request is sent to your server to when the first...
Read more >
Assessing loading performance in the field with Navigation ...
Learn the basics of using the Navigation and Resource Timing APIs to assess loading performance in the field.
Read more >
How to practically use Performance API to measure performance
Using navigation timing API and resource timing API · fetchStart marks when the browser starts to fetch a resource. · requestStart is when...
Read more >
Resource Timing - W3C
Though this script can measure the time it takes to fetch a ... with only the startTime , fetchStart , duration and responseEnd...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found