Skip to content

Commit

Permalink
Add new query for user agent versions. Made query building with dynam…
Browse files Browse the repository at this point in the history
…ic dates more robust.
  • Loading branch information
rmarx committed Jan 25, 2024
1 parent 2c768bd commit bdee872
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ async function runQueries( queries ) {
query.cachePath = cachePath;
continue;
}
else {
console.log(`Executing Query ${query.filename} via BigQuery`);
}

await runBigQuery( query.sql, cachePath, GLOBAL_DEBUG );
query.cachePath = cachePath;
Expand Down Expand Up @@ -216,12 +219,14 @@ async function getQueries() {
}

// concatenate the dates to be used in the sql queries
let allDatesString = "";
let allDatesString = "(";
for ( const [idx, date] of allDates.entries() ) {
allDatesString += "DATE = \"" + date + "\"";
if ( idx != allDates.length - 1 )
allDatesString += " OR ";
}
allDatesString += ")";

const lastDateString = "DATE = \"" + lastDate + "\"";

// run the actual query definitions from filesystem
Expand Down
20 changes: 20 additions & 0 deletions queries/useragentversion_useragentfamily_devicetype.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"description": "Timeseries of the different versions per user agent per device type, ordered by occurrence seen in the RUM Archive dataset",
"datetype": "timeseries",
"processingtype": "groupedMetricPerDevice",
"extractmetric": "version",
"groupby": "family",
"comments": "We exclude null values here due to the already high cardinality of results. We manually select the 'interesting' user agents for the same reason.",
"sql": "
SELECT DATE as date,
USERAGENTVERSION as version,
USERAGENTFAMILY as family,
DEVICETYPE as device,
COUNT(*) as rowcount,
SUM(BEACONS) as beaconcount
FROM `akamai-mpulse-rumarchive.rumarchive.rumarchive_page_loads`
WHERE DEVICETYPE IS NOT NULL and USERAGENTFAMILY IS NOT NULL AND USERAGENTVERSION IS NOT NULL AND {{TIMESERIES_DATES}}
AND USERAGENTFAMILY in ('Chrome', 'Chrome Mobile', 'Chrome Mobile WebView', 'Chrome Mobile iOS', 'Safari', 'Mobile Safari', 'Mobile Safari UI/WKWebView', 'Edge', 'Facebook', 'Firefox', 'Firefox Mobile', 'Opera', 'Opera Mini', 'Samsung Internet', 'Instagram')
GROUP BY DATE, DEVICETYPE, USERAGENTFAMILY, USERAGENTVERSION
ORDER BY DATE ASC, DEVICETYPE ASC, USERAGENTFAMILY ASC, beaconcount DESC"
}

0 comments on commit bdee872

Please sign in to comment.