Closed nicjansma closed 7 years ago
As a developer, I think that the most consumable way to do this is 3. because it eliminates the need to "stitch" data of different types together with an ID, index, or startTime. It also uses less memory than 1. or 2.
WDYT? cc @igrigorik @yoavweiss
Should we consider hanging ST data off the resource timing object instead? That is, merge ST into Resource Timing? I can't think of any use case where ST data is meaningfully separate from the associated RT object?
Yes, that's exactly what we're suggesting with 3. :)
PerformanceResourceTiming = {
connectEnd: 343.98,
connectStart: 343.98,
decodedBodySize: 5087,
domainLookupEnd: 343.98,
domainLookupStart: 343.98,
duration: 45.11500000000001,
encodedBodySize: 5087,
entryType: "resource",
fetchStart: 343.98,
initiatorType: "img",
name: "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png",
redirectEnd: 0,
redirectStart: 0,
requestStart: 344.51000000000005,
responseEnd: 389.095,
responseStart: 345.58500000000004,
secureConnectionStart: 0,
startTime: 343.98,
transferSize: 0,
workerStart: 0,
serverEntries: [{
description: "Total Response Time"
duration: 123.4,
entryType: "server",
metric: "trt"
startTime: 0
}, ... ]
}
Resolved via https://github.com/w3c/server-timing/pull/15.
Because ServerTiming hard-codes
0
for thestartTime
, it's hard to associate ServerTiming entries with their corresponding entries in ResourceTiming.For URLs that are only fetched once on the page, you can filter to ResourceTimings that have the same
name
.But if a URL is fetched more than once, you can't definitively say which ServerTimings relate to other ResourceTimings, other than guessing based on the order. But that might not work if ServerTimings are non-deterministic (happening 0, 1 or many times).
Would we be able to come up with a way of "linking" them better? Maybe:
A unique ID that both ServerTiming and ResourceTiming use to link each other. I thought we had discussed this before, but I couldn't find an issue in any of the RT, ST or PT repos.
Similarly, ServerTiming could have a
resourceStartTime
attribute that would be equal to thestartTime
in the corresponding ResourceTiming entry.ResourceTiming could have a list of ServerTiming objects on its entry.
Thoughts? I realize fetching the same URL multiple times may not be the common case, but it would be nice to ensure we can have confidence in linking the two.