feat: add rating to CrUX field data metrics#1190
feat: add rating to CrUX field data metrics#1190mvanhorn wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
Add Web Vitals ratings (good/needs-improvement/poor) to each CrUX field metric in the performance trace summary output. Ratings are based on the official Web Vitals thresholds: - LCP: good <= 2500ms, poor >= 4000ms - CLS: good <= 0.1, poor >= 0.25 - INP: good <= 200ms, poor >= 500ms - FCP: good <= 1800ms, poor >= 3000ms - TTFB: good <= 800ms, poor >= 1800ms Fixes ChromeDevTools#1055
|
Thanks! I like the end result of this! How about instead of using regexes to add the ratings to the formatted text, adding the ratings directly in |
Replace regex post-processing of formatter output with direct access to CrUX field metrics via DevTools.TraceEngine.Insights.Common. Ratings are now computed from structured data and injected into the summary, avoiding fragile string parsing.
|
Replaced regex post-processing with |
|
Oh, in my first review I missed that the @jackfranklin Would DevTools also benefit from having CrUX ratings added to |
|
I like the idea, but yes we should add that in the trace formatter on the DevTools side, and then roll that into the MCP server. |
|
@wolfib @jackfranklin Got it - makes sense to add the rating logic in the DevTools trace formatter first and then have the MCP server pick it up from there. I can open a PR against the DevTools repo for the PerformanceTraceFormatter changes if that's helpful, or would you prefer to handle it on that side? |
|
CLs (or PRs in GitHub terms!) on DevTools are very welcome; see here for how to get the codebase up and running: https://chromium.googlesource.com/devtools/devtools-frontend/+/refs/heads/chromium/3965/README.md If you send a CL, please add |
|
Thanks for the link. I'll set up the DevTools frontend environment and submit a CL adding rating support to |
Summary
[good],[needs-improvement],[poor]) to each CrUX field metric in the performance trace summary outputExample output change
Before:
After:
Fixes #1055
Test plan
addRatingsToCruxMetricscovering all metrics (LCP, INP, CLS, FCP, TTFB), all rating levels, non-CrUX line passthrough, and multi-line summary handlingThis contribution was developed with AI assistance (Claude Code).