Skip to content

Add /v1/cwv-distribution endpoint#105

Open
max-ostapenko wants to merge 16 commits intomainfrom
development
Open

Add /v1/cwv-distribution endpoint#105
max-ostapenko wants to merge 16 commits intomainfrom
development

Conversation

@max-ostapenko
Copy link
Copy Markdown
Contributor

@max-ostapenko max-ostapenko commented Mar 30, 2026

New Feature: CWV Distribution Endpoint

  • Added a new controller (cwvDistributionController.js) and route (/v1/cwv-distribution) that queries BigQuery for CWV histogram data by technology, with support for filtering by date and rank.

Offers the data for HTTPArchive/httparchive.org#1147

alonkochba and others added 11 commits March 23, 2026 09:43
* feat: add /v1/geo-breakdown endpoint for geographic CWV breakdown

Adds a new controller and route that returns core_web_vitals data for
all geographies for a given technology. Unlike /cwv, this endpoint omits
the geo filter so callers can build a geographic breakdown chart without
issuing one request per country.

* refactor: merge geo-breakdown into reportController factory

Add crossGeo option to createReportController; delete standalone
geoBreakdownController.js. Endpoint now returns a single-month snapshot
(latest by default, or the month specified by the end param).

---------

Co-authored-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
@max-ostapenko max-ostapenko requested a review from tunetheweb April 6, 2026 23:16
@max-ostapenko max-ostapenko marked this pull request as ready for review April 6, 2026 23:17
@max-ostapenko
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Member

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice set of tests too!

@alonkochba
Copy link
Copy Markdown
Member

alonkochba commented Apr 7, 2026

Nice!!
Returned list mixing INP/CLS/LCP concerns is a bit odd, but this would work.

PR here (still need to integrate with this API after merge)
HTTPArchive/httparchive.org#1241

Here's a preview with this hardcoded data:

image image image image image image

@alonkochba
Copy link
Copy Markdown
Member

Don't you want to support geo param though?

@max-ostapenko
Copy link
Copy Markdown
Contributor Author

@alonkochba Added geo support, you can test all the filters now.

The latency may be ~30sec for non-cached responses (due to direct query). A loading animation could be helpful here.

alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 11, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
alonkochba added a commit to alonkochba/httparchive.org that referenced this pull request Apr 13, 2026
Adds a collapsible histogram chart to the CWV section showing how origins
are distributed across performance buckets for LCP, CLS, INP, FCP, and TTFB.

Features:
- Column chart with bars color-coded green/orange/red by CWV thresholds
- Dashed plotlines marking good/needs-improvement boundaries
- Tail buckets aggregated into an overflow "X+" bar so all origins are shown
- Metric selector in the collapsed summary bar for quick switching
- Loading spinner while the API call is in progress
- Error message when data is unavailable
- Light and dark mode support with theme-aware colors
- Anchor link (#section-cwv_distribution) with auto-expand on direct navigation
- URL hash updates when the section is expanded

Fetches data from /v1/cwv-distribution (HTTPArchive/tech-report-apis#105)
with technology, date, rank, and geo parameters.

Also scopes the global .highcharts-point CSS rule to line/spline series only,
so column chart bar colors are not overridden.

Closes HTTPArchive#1147
@tunetheweb
Copy link
Copy Markdown
Member

Some UX suggestions:

This seems quick big for a niche option that is quite slow to run, and that we said we'd leave to the power users:

image

Also I kept clicking on the heading to expand it, but that's the anchor link so I have to hit the tiny triangle instead which isn't obvious.

WDYT instead about a button on the main CWV chart?

image

A lot more subtle, so really only there for power users.

We could also put Geos in a button in the centre, and also not show that by default, since it's quite slow to load. I've noticed it's jarring to me that it comes in so much later. Or maybe that's too subtle for that as Geo's is more useful to most users than Distributions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants