Skip to content

Commit 5403da9

Browse files
authored
Enhanced unique metrics
Updated date filters and added new metrics for WebAssembly requests.
1 parent 1d25a6c commit 5403da9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

sql/2025/webassembly/counts.sql

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ WITH wasmRequests AS (
77
page,
88
root_page,
99
url,
10-
REGEXP_EXTRACT(url, r'([^/]+)$') AS filename -- lowercase & extract filename between last `/` and `.` or `?`
10+
REGEXP_EXTRACT(url, r'([^/]+)$') AS filename,
11+
SAFE_CAST(JSON_VALUE(summary, '$.respBodySize') AS INT64) AS respBodySize
1112
FROM
1213
`httparchive.crawl.requests`
1314
WHERE
14-
date IN ('2021-07-01', '2022-06-01', '2024-06-01', '2025-07-01') AND
15+
date IN ('2021-07-01', '2022-06-01','2023-06-01', '2024-06-01', '2025-07-01') AND
1516
(
16-
(date IN ('2024-06-01', '2025-07-01') AND type = 'wasm') -- wasm type was added in Jan 2024
17+
(date IN ('2024-06-01', '2025-07-01') AND type = 'wasm')
1718
OR
18-
(date IN ('2021-07-01', '2022-06-01') AND (JSON_VALUE(summary.mimeType) = 'application/wasm' OR JSON_VALUE(summary.ext) = 'wasm'))
19+
(date IN ('2021-07-01', '2022-06-01', '2023-06-01') AND (JSON_VALUE(summary, '$.mimeType') = 'application/wasm' OR JSON_VALUE(summary, '$.ext') = 'wasm'))
1920
)
2021
),
2122

@@ -28,7 +29,7 @@ totals AS (
2829
FROM
2930
`httparchive.crawl.requests`
3031
WHERE
31-
date IN ('2021-07-01', '2022-06-01', '2024-06-01', '2025-07-01')
32+
date IN ('2021-07-01', '2022-06-01', '2023-06-01','2024-06-01', '2025-07-01')
3233
GROUP BY
3334
date,
3435
client
@@ -37,8 +38,12 @@ totals AS (
3738
SELECT
3839
date,
3940
client,
40-
COUNT(0) AS total_wasm,
41-
COUNT(DISTINCT filename) AS unique_wasm,
41+
COUNT(0) AS total_wasm_requests,
42+
COUNT(DISTINCT filename) AS unique_filenames,
43+
-- NEW: Distinct based on full URL
44+
COUNT(DISTINCT url) AS unique_urls,
45+
-- NEW: Distinct based on Name + Size
46+
COUNT(DISTINCT CONCAT(filename, '-', CAST(respBodySize AS STRING))) AS unique_wasm_by_size,
4247
COUNT(DISTINCT root_page) AS sites,
4348
total_sites,
4449
COUNT(DISTINCT root_page) / total_sites AS pct_sites,

0 commit comments

Comments
 (0)