RE: [server-timing] Linking to a ResourceTiming entry

Ilya previously suggested a resourceId uses to associate resource timings for identifying relationships such as preflight->xhr. I generally agree that it could be re-used on ServerTiming for association.

What are other folk’s thoughts?

-Todd

From: Nic Jansma [mailto:nic@nicj.net]
Sent: Wednesday, March 4, 2015 7:52 AM
To: public-web-perf@w3.org
Subject: [server-timing] Linking to a ResourceTiming entry

Hi everyone,

From my understanding of ServerTiming, you'll get an entry in the PerformanceTimeline with these attributes:

name (URL of resource)

entryType, startTime, duration (common PerformanceTimline attributes)

metric

description
The example shows how you can get the ServerTiming (and ResourceTiming) for a particular resource:


var serverMetrics = window.performance.getEntriesByName('https://example.com/resource.jpg');

for (i = 0; i < serverMetrics.length; i++) <

/span>{

    entry = serverMetrics[i];

    if (entry == "server") {

      // entry.metric, entry.duration, entry.description

    }

}
But what if the same resource is downloaded twice for some reason?  For example, if there are non-cachable headers on an XHR.  How can you be sure which ServerTIming goes with which ResourceTiming?

Is the startTime guaranteed to be the same for the ServerTiming and ResourceTiming entries?  That would be one way to "link" them.

If not, should we add an additional attribute to link the two in some way?  A "resourceId" that is the same on both ServerTiming and ResourceTiming entries?

It's a bit of an edge case, but something that would be helpful to think through now.


--

- Nic

Received on Wednesday, 4 March 2015 16:46:34 UTC