-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:HTTPArchive/almanac.httparchive.org…
… into production
- Loading branch information
Showing
85 changed files
with
2,688 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CREATE TEMP FUNCTION HAS_NO_STORE_DIRECTIVE(cache_control STRING) RETURNS BOOL AS ( | ||
REGEXP_CONTAINS(cache_control, r'(?i)\bno-store\b') | ||
); | ||
|
||
WITH requests AS ( | ||
SELECT | ||
client, | ||
LOGICAL_OR(HAS_NO_STORE_DIRECTIVE(JSON_VALUE(payload, '$._cacheControl'))) AS includes_ccns | ||
FROM | ||
`httparchive.all.requests` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_main_document | ||
GROUP BY | ||
client, | ||
page | ||
) | ||
|
||
SELECT | ||
client, | ||
COUNTIF(includes_ccns) AS pages, | ||
COUNT(0) AS total, | ||
COUNTIF(includes_ccns) / COUNT(0) AS pct | ||
FROM | ||
requests | ||
GROUP BY | ||
client | ||
ORDER BY | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
WITH lh AS ( | ||
SELECT | ||
client, | ||
page, | ||
rank, | ||
JSON_VALUE(lighthouse, '$.audits.no-unload-listeners.score') = '0' AS has_unload | ||
FROM | ||
`httparchive.all.pages` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
|
||
SELECT | ||
client, | ||
_rank AS rank, | ||
COUNTIF(has_unload) AS pages, | ||
COUNT(0) AS total, | ||
COUNTIF(has_unload) / COUNT(0) AS pct | ||
FROM | ||
lh, | ||
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank | ||
WHERE | ||
rank <= _rank | ||
GROUP BY | ||
client, | ||
rank | ||
ORDER BY | ||
rank, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
WITH lh AS ( | ||
SELECT | ||
client, | ||
ARRAY_LENGTH(JSON_QUERY_ARRAY(lighthouse, '$.audits.non-composited-animations.details.items')) AS num_animations | ||
FROM | ||
`httparchive.all.pages` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
|
||
SELECT | ||
percentile, | ||
client, | ||
APPROX_QUANTILES(num_animations, 1000)[OFFSET(percentile * 10)] AS num_animations, | ||
COUNTIF(num_animations > 0) AS pages, | ||
COUNT(0) AS total, | ||
COUNTIF(num_animations > 0) / COUNT(0) AS pct | ||
FROM | ||
lh, | ||
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile | ||
GROUP BY | ||
percentile, | ||
client | ||
ORDER BY | ||
percentile, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
WITH lh AS ( | ||
SELECT | ||
client, | ||
CAST(JSON_VALUE(unsized_image, '$.node.boundingRect.height') AS INT64) AS height | ||
FROM | ||
`httparchive.all.pages`, | ||
UNNEST(JSON_QUERY_ARRAY(lighthouse, '$.audits.unsized-images.details.items')) AS unsized_image | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
|
||
SELECT | ||
percentile, | ||
client, | ||
APPROX_QUANTILES(height, 1000)[OFFSET(percentile * 10)] AS height, | ||
COUNT(0) AS unsized_images | ||
FROM | ||
lh, | ||
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile | ||
GROUP BY | ||
percentile, | ||
client | ||
ORDER BY | ||
percentile, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
WITH lh AS ( | ||
SELECT | ||
client, | ||
ARRAY_LENGTH(JSON_QUERY_ARRAY(lighthouse, '$.audits.unsized-images.details.items')) AS num_unsized_images | ||
FROM | ||
`httparchive.all.pages` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
|
||
SELECT | ||
percentile, | ||
client, | ||
APPROX_QUANTILES(num_unsized_images, 1000)[OFFSET(percentile * 10)] AS num_unsized_images, | ||
COUNTIF(num_unsized_images > 0) AS pages, | ||
COUNT(0) AS total, | ||
COUNTIF(num_unsized_images > 0) / COUNT(0) AS pct | ||
FROM | ||
lh, | ||
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile | ||
GROUP BY | ||
percentile, | ||
client | ||
ORDER BY | ||
percentile, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
WITH long_tasks AS ( | ||
SELECT | ||
client, | ||
page, | ||
ANY_VALUE(httparchive.core_web_vitals.GET_CRUX_INP(payload)) AS inp, | ||
SUM(CAST(JSON_QUERY(item, '$.duration') AS FLOAT64)) AS long_tasks | ||
FROM | ||
`httparchive.all.pages`, | ||
UNNEST(JSON_QUERY_ARRAY(lighthouse, '$.audits.long-tasks.details.items')) AS item | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
GROUP BY | ||
client, | ||
page | ||
), | ||
|
||
meta AS ( | ||
SELECT | ||
*, | ||
COUNT(0) OVER (PARTITION BY client) AS n, | ||
ROW_NUMBER() OVER (PARTITION BY client ORDER BY inp) AS row | ||
FROM | ||
long_tasks | ||
WHERE | ||
inp IS NOT NULL | ||
) | ||
|
||
SELECT | ||
client, | ||
long_tasks, | ||
inp | ||
FROM | ||
meta | ||
WHERE | ||
MOD(row, CAST(FLOOR(n / 1000) AS INT64)) = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SELECT | ||
percentile, | ||
client, | ||
APPROX_QUANTILES(CAST(JSON_QUERY(lighthouse, '$.audits.total-blocking-time.numericValue') AS FLOAT64), 1000)[OFFSET(percentile * 10)] AS tbt | ||
FROM | ||
`httparchive.all.pages`, | ||
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
GROUP BY | ||
percentile, | ||
client | ||
ORDER BY | ||
percentile, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
SELECT | ||
IF(_rank < 100000000, CAST(_rank AS STRING), 'all') AS rank, | ||
client, | ||
APPROX_QUANTILES(CAST(JSON_VALUE(summary, '$.bytesJS') AS INT64), 1000)[OFFSET(500)] / 1024 AS js_kbytes | ||
FROM | ||
`httparchive.all.pages`, | ||
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page AND | ||
rank <= _rank | ||
GROUP BY | ||
rank, | ||
client | ||
ORDER BY | ||
rank, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
WITH pages AS ( | ||
SELECT | ||
client, | ||
page, | ||
JSON_VALUE(custom_metrics, '$.performance.lcp_elem_stats.url') AS url | ||
FROM | ||
`httparchive.all.pages` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
), | ||
|
||
requests AS ( | ||
SELECT | ||
client, | ||
page, | ||
url, | ||
CAST(JSON_VALUE(summary, '$.respSize') AS INT64) / 1024 AS kbytes | ||
FROM | ||
`httparchive.all.requests` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
SELECT | ||
percentile, | ||
client, | ||
APPROX_QUANTILES(kbytes, 1000)[OFFSET(percentile * 10)] AS kbytes | ||
FROM | ||
pages | ||
JOIN | ||
requests | ||
USING | ||
(client, page, url), | ||
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile | ||
GROUP BY | ||
percentile, | ||
client | ||
ORDER BY | ||
percentile, | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
WITH pages AS ( | ||
SELECT | ||
client, | ||
page, | ||
JSON_VALUE(custom_metrics, '$.performance.lcp_elem_stats.url') AS url | ||
FROM | ||
`httparchive.all.pages` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
), | ||
|
||
requests AS ( | ||
SELECT | ||
client, | ||
page, | ||
url, | ||
CAST(JSON_VALUE(summary, '$.respSize') AS INT64) / 1024 AS kbytes | ||
FROM | ||
`httparchive.all.requests` | ||
WHERE | ||
date = '2023-10-01' AND | ||
is_root_page | ||
) | ||
|
||
SELECT | ||
client, | ||
IF(CEILING(kbytes / 100) * 100 < 1000, CAST(CEILING(kbytes / 100) * 100 AS STRING), '1000+') AS kbytes, | ||
COUNT(0) AS freq, | ||
SUM(COUNT(0)) OVER (PARTITION BY client) AS total, | ||
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct | ||
FROM | ||
pages | ||
JOIN | ||
requests | ||
USING | ||
(client, page, url) | ||
GROUP BY | ||
client, | ||
kbytes | ||
ORDER BY | ||
client, | ||
kbytes |
Oops, something went wrong.