[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++)  {
     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 15:52:31 UTC