Skip to content

Commit 738a9c3

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[AI] Add event key for all urls in insight formatter
Also added nodeId to the LCP element output. Bug: 432028409 Change-Id: I5ed3bf85b4ef5ce488774bd28c22d51f605118d5 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6980506 Auto-Submit: Connor Clark <cjamcl@chromium.org> Commit-Queue: Paul Irish <paulirish@chromium.org> Reviewed-by: Paul Irish <paulirish@chromium.org>
1 parent 0ede77d commit 738a9c3

3 files changed

Lines changed: 105 additions & 85 deletions

File tree

front_end/models/ai_assistance/agents/PerformanceAgent.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,6 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
388388
* 1. go to paulirish.com, record a trace
389389
* 2. say "What performance issues exist with my page?"
390390
* 3. then say "images"
391-
*
392-
* TODO(cjamcl): reduce the reliance on this by making sure all URL references
393-
* (such as the insight formatters) add the "eventKey" as a suffix, just like all
394-
* other events.
395391
*/
396392
#parseForKnownUrls(response: string): string {
397393
const focus = this.context?.getItem();

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This insight is used to analyze the time spent that contributed to the final LCP
77

88
## Detailed analysis:
99
The Largest Contentful Paint (LCP) time for this navigation was 240 ms.
10-
The LCP element (IMG) is an image fetched from `https://creativetouchrotherham.co.uk/images/creative-touch-home/creative_touch_rotherham_homehero/creative_touch_rotherham_homehero_700.webp`.
10+
The LCP element (IMG, nodeId: 23) is an image fetched from https://creativetouchrotherham.co.uk/images/creative-touch-home/creative_touch_rotherham_homehero/creative_touch_rotherham_homehero_700.webp (eventKey: s-1418).
1111
## LCP resource network request: https://creativetouchrotherham.co.uk/images/creative-touch-home/creative_touch_rotherham_homehero/creative_touch_rotherham_homehero_700.webp
1212
eventKey: s-1418
1313
Timings:
@@ -68,7 +68,7 @@ This insight is used to analyze the time spent that contributed to the final LCP
6868

6969
## Detailed analysis:
7070
The Largest Contentful Paint (LCP) time for this navigation was 129 ms.
71-
The LCP element is an image fetched from `https://web-dev.imgix.net/image/kheDArv5csY6rvQUJDbWRscckLr1/4i7JstVZvgTFk9dxCe4a.svg`.
71+
The LCP element is an image fetched from https://web-dev.imgix.net/image/kheDArv5csY6rvQUJDbWRscckLr1/4i7JstVZvgTFk9dxCe4a.svg (eventKey: s-1314).
7272
## LCP resource network request: https://web-dev.imgix.net/image/kheDArv5csY6rvQUJDbWRscckLr1/4i7JstVZvgTFk9dxCe4a.svg
7373
eventKey: s-1314
7474
Timings:
@@ -186,7 +186,7 @@ It is important that all of these checks pass to minimize the delay between the
186186

187187
## Detailed analysis:
188188
The Largest Contentful Paint (LCP) time for this navigation was 1,077 ms.
189-
The LCP element is an image fetched from `http://localhost:8787/lcp-discovery-delay/lcp-image.jpg`.
189+
The LCP element is an image fetched from http://localhost:8787/lcp-discovery-delay/lcp-image.jpg (eventKey: s-25281).
190190
## LCP resource network request: http://localhost:8787/lcp-discovery-delay/lcp-image.jpg
191191
eventKey: s-25281
192192
Timings:
@@ -310,7 +310,7 @@ Layout shifts in this cluster:
310310
- Start time: 472 ms
311311
- Score: 0.0003
312312
- Potential root causes:
313-
- A font that was loaded over the network (https://fonts.gstatic.com/s/specialgothicexpandedone/v2/IurO6Zxk74-YaYk1r3HOet4g75ENmBxUmOK61tA0Iu5QmJF_.woff2).
313+
- A font that was loaded over the network: https://fonts.gstatic.com/s/specialgothicexpandedone/v2/IurO6Zxk74-YaYk1r3HOet4g75ENmBxUmOK61tA0Iu5QmJF_.woff2 (eventKey: s-1158).
314314
### Layout shift 2:
315315
- Start time: 857 ms
316316
- Score: 0.0844
@@ -320,12 +320,12 @@ Layout shifts in this cluster:
320320
- Start time: 1,352 ms
321321
- Score: 0.0068
322322
- Potential root causes:
323-
- An unsized image (IMG) (url: http://localhost:8000/unsized-image.png).
323+
- An unsized image (IMG) (url: http://localhost:8000/unsized-image.png (eventKey: s-4487)).
324324
### Layout shift 4:
325325
- Start time: 1,537 ms
326326
- Score: 0.3344
327327
- Potential root causes:
328-
- An unsized image (IMG) (url: http://localhost:8000/unsized-image.png).
328+
- An unsized image (IMG) (url: http://localhost:8000/unsized-image.png (eventKey: s-4487)).
329329
### Layout shift 5:
330330
- Start time: 2,343 ms
331331
- Score: 0.3396
@@ -589,16 +589,16 @@ Total legacy JavaScript: 8 files.
589589

590590
Legacy JavaScript by file:
591591

592-
- Script: https://s.yimg.com/aaq/benji/benji-2.2.99.js - Wasted bytes: 37204 bytes
592+
- Script: https://s.yimg.com/aaq/benji/benji-2.2.99.js (eventKey: s-3387) - Wasted bytes: 37204 bytes
593593
Matches:
594594
Line: 0, Column: 133, Name: Promise.allSettled
595595

596-
- Script: https://s.yimg.com/aaq/c/25fa214.caas-news_web.min.js - Wasted bytes: 36084 bytes
596+
- Script: https://s.yimg.com/aaq/c/25fa214.caas-news_web.min.js (eventKey: s-3412) - Wasted bytes: 36084 bytes
597597
Matches:
598598
Line: 0, Column: 13310, Name: Array.from
599599
Line: 0, Column: 14623, Name: Object.assign
600600

601-
- Script: https://s.yimg.com/du/ay/wnsrvbjmeprtfrnfx.js - Wasted bytes: 12850 bytes
601+
- Script: https://s.yimg.com/du/ay/wnsrvbjmeprtfrnfx.js (eventKey: s-6273) - Wasted bytes: 12850 bytes
602602
Matches:
603603
Line: 111, Column: 7829, Name: @babel/plugin-transform-spread
604604
Line: 111, Column: 1794, Name: Array.prototype.find
@@ -607,29 +607,29 @@ Line: 111, Column: 2748, Name: Object.values
607607
Line: 111, Column: 2473, Name: String.prototype.includes
608608
Line: 111, Column: 2627, Name: String.prototype.startsWith
609609

610-
- Script: https://static.criteo.net/js/ld/publishertag.prebid.144.js - Wasted bytes: 10751 bytes
610+
- Script: https://static.criteo.net/js/ld/publishertag.prebid.144.js (eventKey: s-257378) - Wasted bytes: 10751 bytes
611611
Matches:
612612
Line: 1, Column: 74871, Name: Array.isArray
613613
Line: 1, Column: 75344, Name: Array.prototype.filter
614614
Line: 1, Column: 75013, Name: Array.prototype.indexOf
615615

616-
- Script: https://s.yimg.com/oa/consent.js - Wasted bytes: 8157 bytes
616+
- Script: https://s.yimg.com/oa/consent.js (eventKey: s-3384) - Wasted bytes: 8157 bytes
617617
Matches:
618618
Line: 1, Column: 132267, Name: Array.prototype.includes
619619

620-
- Script: https://pm-widget.taboola.com/yahooweb-network/pmk-20220605.1.js - Wasted bytes: 7625 bytes
620+
- Script: https://pm-widget.taboola.com/yahooweb-network/pmk-20220605.1.js (eventKey: s-52229) - Wasted bytes: 7625 bytes
621621
Matches:
622622
Line: 181, Column: 26, Name: Object.keys
623623

624-
- Script: https://news.yahoo.com/ - Wasted bytes: 7141 bytes
624+
- Script: https://news.yahoo.com/ (eventKey: s-2116) - Wasted bytes: 7141 bytes
625625
Matches:
626626
Line: 0, Column: 8382, Name: @babel/plugin-transform-classes
627627
Line: 0, Column: 107712, Name: Array.prototype.filter
628628
Line: 0, Column: 107393, Name: Array.prototype.forEach
629629
Line: 0, Column: 108005, Name: Array.prototype.map
630630
Line: 0, Column: 108358, Name: String.prototype.includes
631631

632-
- Script: https://cdn.taboola.com/libtrc/yahooweb-network/loader.js - Wasted bytes: 7061 bytes
632+
- Script: https://cdn.taboola.com/libtrc/yahooweb-network/loader.js (eventKey: s-6352) - Wasted bytes: 7061 bytes
633633
Matches:
634634
Line: 0, Column: 390544, Name: Object.entries
635635
Line: 0, Column: 390688, Name: Object.values
@@ -669,12 +669,12 @@ This insight identifies font issues when a webpage uses custom fonts, for exampl
669669
## Detailed analysis:
670670
The following font display issues were found:
671671

672-
- Font name: jizaRExUiTo99u79D0KExcOPIDU.woff2, URL: https://fonts.gstatic.com/s/ptsans/v17/jizaRExUiTo99u79D0KExcOPIDU.woff2, Property 'font-display' set to: 'auto', Wasted time: 20 ms.
673-
- Font name: SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2, URL: https://fonts.gstatic.com/s/droidsans/v18/SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2, Property 'font-display' set to: 'auto', Wasted time: 15 ms.
674-
- Font name: jizfRExUiTo99u79B_mh0O6tLR8a8zI.woff2, URL: https://fonts.gstatic.com/s/ptsans/v17/jizfRExUiTo99u79B_mh0O6tLR8a8zI.woff2, Property 'font-display' set to: 'auto', Wasted time: 15 ms.
675-
- Font name: SlGWmQWMvZQIdix7AFxXmMh3eDs1ZyHKpWg.woff2, URL: https://fonts.gstatic.com/s/droidsans/v18/SlGWmQWMvZQIdix7AFxXmMh3eDs1ZyHKpWg.woff2, Property 'font-display' set to: 'auto', Wasted time: 15 ms.
676-
- Font name: EJRVQgYoZZY2vCFuvAFWzr-_dSb_.woff2, URL: https://fonts.gstatic.com/s/ptserif/v18/EJRVQgYoZZY2vCFuvAFWzr-_dSb_.woff2, Property 'font-display' set to: 'auto', Wasted time: 15 ms.
677-
- Font name: S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2, URL: https://fonts.gstatic.com/s/lato/v24/S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2, Property 'font-display' set to: 'auto', Wasted time: 10 ms.
672+
- Font name: jizaRExUiTo99u79D0KExcOPIDU.woff2, URL: https://fonts.gstatic.com/s/ptsans/v17/jizaRExUiTo99u79D0KExcOPIDU.woff2 (eventKey: s-5246), Property 'font-display' set to: 'auto', Wasted time: 20 ms.
673+
- Font name: SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2, URL: https://fonts.gstatic.com/s/droidsans/v18/SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2 (eventKey: s-5232), Property 'font-display' set to: 'auto', Wasted time: 15 ms.
674+
- Font name: jizfRExUiTo99u79B_mh0O6tLR8a8zI.woff2, URL: https://fonts.gstatic.com/s/ptsans/v17/jizfRExUiTo99u79B_mh0O6tLR8a8zI.woff2 (eventKey: s-5259), Property 'font-display' set to: 'auto', Wasted time: 15 ms.
675+
- Font name: SlGWmQWMvZQIdix7AFxXmMh3eDs1ZyHKpWg.woff2, URL: https://fonts.gstatic.com/s/droidsans/v18/SlGWmQWMvZQIdix7AFxXmMh3eDs1ZyHKpWg.woff2 (eventKey: s-5269), Property 'font-display' set to: 'auto', Wasted time: 15 ms.
676+
- Font name: EJRVQgYoZZY2vCFuvAFWzr-_dSb_.woff2, URL: https://fonts.gstatic.com/s/ptserif/v18/EJRVQgYoZZY2vCFuvAFWzr-_dSb_.woff2 (eventKey: s-5325), Property 'font-display' set to: 'auto', Wasted time: 15 ms.
677+
- Font name: S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2, URL: https://fonts.gstatic.com/s/lato/v24/S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2 (eventKey: s-5238), Property 'font-display' set to: 'auto', Wasted time: 10 ms.
678678

679679
Consider setting [`font-display`](https://developer.chrome.com/blog/font-display) to `swap` or `optional` to ensure text is consistently visible. `swap` can be further optimized to mitigate layout shifts with [font metric overrides](https://developer.chrome.com/blog/font-fallbacks).
680680

@@ -714,28 +714,28 @@ Total potential savings: 2 MB
714714

715715
The following images could be optimized:
716716

717-
### https://images.ctfassets.net/u275ja1nivmq/6T6z40ay5GFCUtwV7DONgh/0e23606ed1692d9721ab0f39a8d8a99e/yeti_cover.jpg
717+
### https://images.ctfassets.net/u275ja1nivmq/6T6z40ay5GFCUtwV7DONgh/0e23606ed1692d9721ab0f39a8d8a99e/yeti_cover.jpg (eventKey: s-1212)
718718
- Potential savings: 1.1 MB
719719
- Optimizations:
720720
Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image's download size. (Est 1.1 MB)
721721

722-
### https://raw.githubusercontent.com/GoogleChrome/lighthouse/refs/heads/main/cli/test/fixtures/dobetterweb/lighthouse-rotating.gif
722+
### https://raw.githubusercontent.com/GoogleChrome/lighthouse/refs/heads/main/cli/test/fixtures/dobetterweb/lighthouse-rotating.gif (eventKey: s-1216)
723723
- Potential savings: 682 kB
724724
- Optimizations:
725725
Using video formats instead of GIFs can improve the download size of animated content. (Est 682 kB)
726726

727-
### https://onlinepngtools.com/images/examples-onlinepngtools/elephant-hd-quality.png
727+
### https://onlinepngtools.com/images/examples-onlinepngtools/elephant-hd-quality.png (eventKey: s-1228)
728728
- Potential savings: 176 kB
729729
- Optimizations:
730730
Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image's download size. (Est 134.1 kB)
731731
This image file is larger than it needs to be (640x436) for its displayed dimensions (200x136). Use responsive images to reduce the image download size. (Est 162.9 kB)
732732

733-
### https://images.ctfassets.net/u275ja1nivmq/6T6z40ay5GFCUtwV7DONgh/0e23606ed1692d9721ab0f39a8d8a99e/yeti_cover.jpg?fm=webp
733+
### https://images.ctfassets.net/u275ja1nivmq/6T6z40ay5GFCUtwV7DONgh/0e23606ed1692d9721ab0f39a8d8a99e/yeti_cover.jpg?fm=webp (eventKey: s-1224)
734734
- Potential savings: 49.8 kB
735735
- Optimizations:
736736
Increasing the image compression factor could improve this image's download size. (Est 49.8 kB)
737737

738-
### https://raw.githubusercontent.com/GoogleChrome/lighthouse/refs/heads/main/cli/test/fixtures/byte-efficiency/lighthouse-2048x1356.webp
738+
### https://raw.githubusercontent.com/GoogleChrome/lighthouse/refs/heads/main/cli/test/fixtures/byte-efficiency/lighthouse-2048x1356.webp (eventKey: s-1226)
739739
- Potential savings: 41.4 kB
740740
- Optimizations:
741741
This image file is larger than it needs to be (2048x1356) for its displayed dimensions (200x132). Use responsive images to reduce the image download size. (Est 41.4 kB)
@@ -852,9 +852,9 @@ The network dependency tree checks found one or more problems.
852852
Max critical path latency is 5,015 ms
853853

854854
The following is the critical request chain:
855-
- http://localhost:8787/lcp-iframes/index.html (5,006 ms) (longest chain)
856-
- http://localhost:8787/lcp-iframes/app.js (5,015 ms) (longest chain)
857-
- http://localhost:8787/lcp-iframes/app.css (5,010 ms)
855+
- http://localhost:8787/lcp-iframes/index.html (eventKey: s-7103) (5,006 ms) (longest chain)
856+
- http://localhost:8787/lcp-iframes/app.js (eventKey: s-7225) (5,015 ms) (longest chain)
857+
- http://localhost:8787/lcp-iframes/app.css (eventKey: s-7213) (5,010 ms)
858858

859859
no origins were preconnected.
860860

@@ -979,7 +979,7 @@ This insight identifies static resources that are not cached effectively by the
979979
## Detailed analysis:
980980
The following resources were associated with ineffficient cache policies:
981981

982-
- https://chromedevtools.github.io/performance-stories/lcp-large-image/app.css
982+
- https://chromedevtools.github.io/performance-stories/lcp-large-image/app.css (eventKey: s-1106)
983983
- Cache Time to Live (TTL): 600 seconds
984984
- Wasted bytes: 0 B
985985

0 commit comments

Comments
 (0)