Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP/3 SQL query #111

Merged
merged 2 commits into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions sql/timeseries/h3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#standardSQL
# The amount of requests either using HTTP/3 or able to use it.
#
# We measure "ability to use" as well as "actual use", as HTTP Archive is a
# cold crawl and so less likely to use HTTP/3 which requires prior visits.
#
# For "able to use" we look at the alt-svc response header.
#
# We also only measure official HTTP/3 (ALPN h3, h3-29) and not gQUIC or other
# prior versions. h3-29 is the final draft version and will be switched to h3
# when HTTP/3 is approved so we include that as it is HTTP/3 in all but name.
#
SELECT
SUBSTR(_TABLE_SUFFIX, 0, 10) AS date,
UNIX_DATE(CAST(REPLACE(SUBSTR(_TABLE_SUFFIX, 0, 10), '_', '-') AS DATE)) * 1000 * 60 * 60 * 24 AS timestamp,
IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
ROUND(SUM(IF(respHttpVersion IN ('HTTP/3', 'h3', 'h3-29')
OR reqHttpVersion IN ('HTTP/3', 'h3', 'h3-29')
OR REGEXP_EXTRACT(REGEXP_EXTRACT(respOtherHeaders, r'alt-svc = (.*)'), r'(.*?)(?:, [^ ]* = .*)?$') LIKE '%h3=%'
OR REGEXP_EXTRACT(REGEXP_EXTRACT(respOtherHeaders, r'alt-svc = (.*)'), r'(.*?)(?:, [^ ]* = .*)?$') LIKE '%h3-29=%'
rviscomi marked this conversation as resolved.
Show resolved Hide resolved
, 1, 0)) * 100 / COUNT(0), 2) AS percent
FROM
`httparchive.summary_requests.*`
WHERE
SUBSTR(_TABLE_SUFFIX, 0, 10) >= '2020_01_01'
tunetheweb marked this conversation as resolved.
Show resolved Hide resolved
GROUP BY
date,
timestamp,
client
ORDER BY
date DESC,
client