GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.4k stars 9.39k forks source link

Add URL attribution in LH Report #15008

Open alexnj opened 1 year ago

alexnj commented 1 year ago

With 10.1, we have all URLs classified against their responsible entities. It's now easy to identify a 1P/3P URL and understand who it belongs to. It would be good to provide further visibility into who "invited" a URL/entity in — essentially bringing in the full dependency information.

I'm visualizing this as a tooltip on any report URL. We could use dependency graph computed audit / initiator to find the parent of a URL, and expose it in LHR as a Record<url:string, parent:number> (or a minimum-prefix Trie structure if the URL payload increase is a concern).

PS: My mental model around this is: In 10.1 we added the answer to "Who are all in my party?". This should help answer better the question, "Who gave this URL/entity the ticket in?". Since this information could benefit attribution of all URLs and not just 3Ps, it might be better implemented as a report-wide implementation.

connorjclark commented 1 year ago

or a minimum-prefix Trie structure if the URL payload increase is a concern

FWIW this is what I did here for node stack traces: https://github.com/GoogleChrome/lighthouse/pull/14420 , it's similar to how the protocol does a DOM snapshot.