From a986973df4eccd3c9d31f6a2e7bebf0fcc4b9902 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Wed, 14 Jan 2015 22:39:54 +0100 Subject: [PATCH] simplified creation of wpt metric #546 --- lib/aggregators/webpagetest/TTFB.js | 13 +++++ lib/aggregators/webpagetest/bytes.js | 13 +++++ lib/aggregators/webpagetest/firstPaint.js | 13 +++++ lib/aggregators/webpagetest/firstViewBytes.js | 21 ------- .../webpagetest/firstViewFirstPaint.js | 21 ------- .../webpagetest/firstViewImageSavings.js | 21 ------- .../webpagetest/firstViewImageTotal.js | 21 ------- .../webpagetest/firstViewLoadTime.js | 21 ------- .../webpagetest/firstViewRender.js | 21 ------- .../webpagetest/firstViewRequest.js | 21 ------- .../webpagetest/firstViewServerRTT.js | 20 ------- .../webpagetest/firstViewSpeedIndex.js | 22 -------- lib/aggregators/webpagetest/firstViewTTFB.js | 21 ------- .../webpagetest/firstViewUserTimings.js | 55 ------------------ .../webpagetest/firstViewVisualComplete.js | 21 ------- lib/aggregators/webpagetest/imageSavings.js | 14 +++++ lib/aggregators/webpagetest/imageTotal.js | 14 +++++ lib/aggregators/webpagetest/loadTime.js | 12 ++++ lib/aggregators/webpagetest/render.js | 13 +++++ .../webpagetest/repeatViewBytes.js | 23 -------- .../webpagetest/repeatViewFirstPaint.js | 23 -------- .../webpagetest/repeatViewImageSavings.js | 21 ------- .../webpagetest/repeatViewImageTotal.js | 21 ------- .../webpagetest/repeatViewLoadTime.js | 23 -------- .../webpagetest/repeatViewRender.js | 21 ------- .../webpagetest/repeatViewRequest.js | 23 -------- .../webpagetest/repeatViewServerRTT.js | 20 ------- .../webpagetest/repeatViewSpeedIndex.js | 24 -------- lib/aggregators/webpagetest/repeatViewTTFB.js | 21 ------- .../webpagetest/repeatViewUserTimings.js | 56 ------------------- .../webpagetest/repeatViewVisualComplete.js | 23 -------- lib/aggregators/webpagetest/request.js | 13 +++++ lib/aggregators/webpagetest/serverRTT.js | 13 +++++ lib/aggregators/webpagetest/speedIndex.js | 12 ++++ lib/aggregators/webpagetest/userTimings.js | 18 ++++++ lib/aggregators/webpagetest/visualComplete.js | 13 +++++ 36 files changed, 161 insertions(+), 585 deletions(-) create mode 100644 lib/aggregators/webpagetest/TTFB.js create mode 100644 lib/aggregators/webpagetest/bytes.js create mode 100644 lib/aggregators/webpagetest/firstPaint.js delete mode 100644 lib/aggregators/webpagetest/firstViewBytes.js delete mode 100644 lib/aggregators/webpagetest/firstViewFirstPaint.js delete mode 100644 lib/aggregators/webpagetest/firstViewImageSavings.js delete mode 100644 lib/aggregators/webpagetest/firstViewImageTotal.js delete mode 100644 lib/aggregators/webpagetest/firstViewLoadTime.js delete mode 100644 lib/aggregators/webpagetest/firstViewRender.js delete mode 100644 lib/aggregators/webpagetest/firstViewRequest.js delete mode 100644 lib/aggregators/webpagetest/firstViewServerRTT.js delete mode 100644 lib/aggregators/webpagetest/firstViewSpeedIndex.js delete mode 100644 lib/aggregators/webpagetest/firstViewTTFB.js delete mode 100644 lib/aggregators/webpagetest/firstViewUserTimings.js delete mode 100644 lib/aggregators/webpagetest/firstViewVisualComplete.js create mode 100644 lib/aggregators/webpagetest/imageSavings.js create mode 100644 lib/aggregators/webpagetest/imageTotal.js create mode 100644 lib/aggregators/webpagetest/loadTime.js create mode 100644 lib/aggregators/webpagetest/render.js delete mode 100644 lib/aggregators/webpagetest/repeatViewBytes.js delete mode 100644 lib/aggregators/webpagetest/repeatViewFirstPaint.js delete mode 100644 lib/aggregators/webpagetest/repeatViewImageSavings.js delete mode 100644 lib/aggregators/webpagetest/repeatViewImageTotal.js delete mode 100644 lib/aggregators/webpagetest/repeatViewLoadTime.js delete mode 100644 lib/aggregators/webpagetest/repeatViewRender.js delete mode 100644 lib/aggregators/webpagetest/repeatViewRequest.js delete mode 100644 lib/aggregators/webpagetest/repeatViewServerRTT.js delete mode 100644 lib/aggregators/webpagetest/repeatViewSpeedIndex.js delete mode 100644 lib/aggregators/webpagetest/repeatViewTTFB.js delete mode 100644 lib/aggregators/webpagetest/repeatViewUserTimings.js delete mode 100644 lib/aggregators/webpagetest/repeatViewVisualComplete.js create mode 100644 lib/aggregators/webpagetest/request.js create mode 100644 lib/aggregators/webpagetest/serverRTT.js create mode 100644 lib/aggregators/webpagetest/speedIndex.js create mode 100644 lib/aggregators/webpagetest/userTimings.js create mode 100644 lib/aggregators/webpagetest/visualComplete.js diff --git a/lib/aggregators/webpagetest/TTFB.js b/lib/aggregators/webpagetest/TTFB.js new file mode 100644 index 000000000..52250c0e9 --- /dev/null +++ b/lib/aggregators/webpagetest/TTFB.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('TTFBWPT', + 'TTFB', + 'Time To First Byte (fetched using WebPageTest)', + 'timing', 'milliseconds', 0, + 'TTFB'); diff --git a/lib/aggregators/webpagetest/bytes.js b/lib/aggregators/webpagetest/bytes.js new file mode 100644 index 000000000..ab1f7c477 --- /dev/null +++ b/lib/aggregators/webpagetest/bytes.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('bytesWPT', + 'Size', + 'The size in bytes', 'pagemetric', 'bytes', 0, + 'bytesIn' +); diff --git a/lib/aggregators/webpagetest/firstPaint.js b/lib/aggregators/webpagetest/firstPaint.js new file mode 100644 index 000000000..c7b76a455 --- /dev/null +++ b/lib/aggregators/webpagetest/firstPaint.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('firstPaintWPT', + 'First Paint', + 'The first paint time (fetched using WebPageTest)', + 'timing', 'milliseconds', 0, + 'firstPaint'); diff --git a/lib/aggregators/webpagetest/firstViewBytes.js b/lib/aggregators/webpagetest/firstViewBytes.js deleted file mode 100644 index 533b708b3..000000000 --- a/lib/aggregators/webpagetest/firstViewBytes.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewBytesWPT', - 'Size First View', - 'The size in bytes for the first view', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.bytesIn); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewFirstPaint.js b/lib/aggregators/webpagetest/firstViewFirstPaint.js deleted file mode 100644 index 4df41e1ed..000000000 --- a/lib/aggregators/webpagetest/firstViewFirstPaint.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewFirstPaintWPT', - 'First Paint First View', - 'The first paint time (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.firstPaint); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewImageSavings.js b/lib/aggregators/webpagetest/firstViewImageSavings.js deleted file mode 100644 index ed7a6570b..000000000 --- a/lib/aggregators/webpagetest/firstViewImageSavings.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewImageSavingsWPT', - 'Image Savings First View', - 'How much that can be saved if the images are compressed (fetched using WebPageTest)', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.image_savings); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewImageTotal.js b/lib/aggregators/webpagetest/firstViewImageTotal.js deleted file mode 100644 index 8344e1449..000000000 --- a/lib/aggregators/webpagetest/firstViewImageTotal.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewImageTotalWPT', - 'Image Size First View', - 'Total image size (fetched using WebPageTest)', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.image_total); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewLoadTime.js b/lib/aggregators/webpagetest/firstViewLoadTime.js deleted file mode 100644 index 5e93b9184..000000000 --- a/lib/aggregators/webpagetest/firstViewLoadTime.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewLoadTimeWPT', - 'Load Time First View', - 'The Load Time', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.loadTime); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewRender.js b/lib/aggregators/webpagetest/firstViewRender.js deleted file mode 100644 index 3228aa41b..000000000 --- a/lib/aggregators/webpagetest/firstViewRender.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewRenderWPT', - 'Render First View', - 'Render time (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.render); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewRequest.js b/lib/aggregators/webpagetest/firstViewRequest.js deleted file mode 100644 index e477f3e3f..000000000 --- a/lib/aggregators/webpagetest/firstViewRequest.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewRequestsWPT', - 'Requests First View', - 'The number of requests for the first view', 'pagemetric', '', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.requests); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewServerRTT.js b/lib/aggregators/webpagetest/firstViewServerRTT.js deleted file mode 100644 index d35464bf0..000000000 --- a/lib/aggregators/webpagetest/firstViewServerRTT.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewServerRTTWPT', 'Round Trip Time', - 'Estimated Server Round Trip Time', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.server_rtt); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewSpeedIndex.js b/lib/aggregators/webpagetest/firstViewSpeedIndex.js deleted file mode 100644 index 66b4495b7..000000000 --- a/lib/aggregators/webpagetest/firstViewSpeedIndex.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewSpeedIndexWPT', - 'Speed Index First View', - 'The Speed Index is the average time at which visible parts of the page are displayed. It is expressed in milliseconds and dependent on size of the view port. (fetched using WebPageTest)', - 'timing', '', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.SpeedIndex); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewTTFB.js b/lib/aggregators/webpagetest/firstViewTTFB.js deleted file mode 100644 index 2b44988c5..000000000 --- a/lib/aggregators/webpagetest/firstViewTTFB.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewTTFBWPT', - 'TTFB First View', - 'Time To First Byte (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.TTFB); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/firstViewUserTimings.js b/lib/aggregators/webpagetest/firstViewUserTimings.js deleted file mode 100644 index 33a60952b..000000000 --- a/lib/aggregators/webpagetest/firstViewUserTimings.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Stats = require('fast-stats').Stats; -var util = require('../../util/util'); -var userTimings = {}; - -// The aggregator id is used to print error messages. A better design for 'dynamic' aggregators is needed, -// but this will do for now. -exports.id = 'wptFirstViewMetrics'; - -exports.processPage = function(pageData) { - if (pageData.webpagetest) { - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (run.firstView.results.userTimes) { - Object.keys(run.firstView.results.userTimes).forEach(function(userTiming) { - if (userTimings.hasOwnProperty(userTiming)) { - userTimings[userTiming].push(Number(run.firstView.results.userTimes[userTiming])); - } else { - userTimings[userTiming] = new Stats().push(Number(run.firstView.results.userTimes[ - userTiming])); - } - }); - } - }); - }); - } -}; - - -exports.generateResults = function() { - var keys = Object.keys(userTimings), - result = []; - - for (var i = 0; i < keys.length; i++) { - result.push({ - id: 'firstView' + keys[i] + 'WPT', - title: keys[i] + ' first view', - desc: 'User Timing API metric', - type: 'timing', - stats: util.getStatisticsObject(userTimings[keys[i]], 0), - unit: 'milliseconds' - }); - } - - return result; -}; - -exports.clear = function() { - userTimings = {}; -}; diff --git a/lib/aggregators/webpagetest/firstViewVisualComplete.js b/lib/aggregators/webpagetest/firstViewVisualComplete.js deleted file mode 100644 index 766f242b8..000000000 --- a/lib/aggregators/webpagetest/firstViewVisualComplete.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('firstViewVisualCompleteWPT', - 'Visual Complete First View', - 'Time of the last visual change to the page (fetched using WebPageTest).', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.firstView.results.visualComplete); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/imageSavings.js b/lib/aggregators/webpagetest/imageSavings.js new file mode 100644 index 000000000..570e1b0f2 --- /dev/null +++ b/lib/aggregators/webpagetest/imageSavings.js @@ -0,0 +1,14 @@ +/** +* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) +* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog +* and other contributors +* Released under the Apache 2.0 License +*/ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('imageSavingsWPT', +'Image Savings', +'How much that can be saved if the images are compressed (fetched using WebPageTest)', +'pagemetric', 'bytes', 0, +'image_savings' +); diff --git a/lib/aggregators/webpagetest/imageTotal.js b/lib/aggregators/webpagetest/imageTotal.js new file mode 100644 index 000000000..08a8a8d04 --- /dev/null +++ b/lib/aggregators/webpagetest/imageTotal.js @@ -0,0 +1,14 @@ +/** +* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) +* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog +* and other contributors +* Released under the Apache 2.0 License +*/ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('imageTotalWPT', +'Image Size', +'Total image size (fetched using WebPageTest)', 'pagemetric', +'bytes', 0, +'image_total' +); diff --git a/lib/aggregators/webpagetest/loadTime.js b/lib/aggregators/webpagetest/loadTime.js new file mode 100644 index 000000000..b6413e0d8 --- /dev/null +++ b/lib/aggregators/webpagetest/loadTime.js @@ -0,0 +1,12 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('loadTimeWPT', + 'Load Time', + 'The Load Time', 'timing', + 'milliseconds', 0, 'loadTime'); diff --git a/lib/aggregators/webpagetest/render.js b/lib/aggregators/webpagetest/render.js new file mode 100644 index 000000000..6c1700137 --- /dev/null +++ b/lib/aggregators/webpagetest/render.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('renderWPT', + 'Render', + 'Render time (fetched using WebPageTest)', + 'timing', 'milliseconds', 0, + 'render'); diff --git a/lib/aggregators/webpagetest/repeatViewBytes.js b/lib/aggregators/webpagetest/repeatViewBytes.js deleted file mode 100644 index f180c9342..000000000 --- a/lib/aggregators/webpagetest/repeatViewBytes.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewBytesWPT', - 'Size Repeat View', - 'The size in bytes for the repeat view', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.bytesIn); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewFirstPaint.js b/lib/aggregators/webpagetest/repeatViewFirstPaint.js deleted file mode 100644 index be41a6cf4..000000000 --- a/lib/aggregators/webpagetest/repeatViewFirstPaint.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewFirstPaintWPT', - 'First Paint Repeat View', - 'The first paint time (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.firstPaint); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewImageSavings.js b/lib/aggregators/webpagetest/repeatViewImageSavings.js deleted file mode 100644 index e459639cf..000000000 --- a/lib/aggregators/webpagetest/repeatViewImageSavings.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewImageSavingsWPT', - 'Image Savings Repeat View', - 'How much that can be saved if the images are compressed (fetched using WebPageTest)', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.repeatView.results.image_savings); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewImageTotal.js b/lib/aggregators/webpagetest/repeatViewImageTotal.js deleted file mode 100644 index bcf044455..000000000 --- a/lib/aggregators/webpagetest/repeatViewImageTotal.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewImageTotalWPT', - 'Image Size Repeat View', - 'Total image size (fetched using WebPageTest)', 'pagemetric', 'bytes', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.repeatView.results.image_total); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewLoadTime.js b/lib/aggregators/webpagetest/repeatViewLoadTime.js deleted file mode 100644 index 9e7e09372..000000000 --- a/lib/aggregators/webpagetest/repeatViewLoadTime.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewLoadTimeWPT', - 'Load Time Repeat View', - 'The Load Time', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.loadTime); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewRender.js b/lib/aggregators/webpagetest/repeatViewRender.js deleted file mode 100644 index af66d2162..000000000 --- a/lib/aggregators/webpagetest/repeatViewRender.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewRenderWPT', - 'Render Repeat View', - 'Render time (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.repeatView.results.render); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewRequest.js b/lib/aggregators/webpagetest/repeatViewRequest.js deleted file mode 100644 index 0a9ea074a..000000000 --- a/lib/aggregators/webpagetest/repeatViewRequest.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewRequestsWPT', - 'Requests Repeat View', - 'The number of requests for the repeat view', 'pagemetric', '', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.requests); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewServerRTT.js b/lib/aggregators/webpagetest/repeatViewServerRTT.js deleted file mode 100644 index 0b463cbe0..000000000 --- a/lib/aggregators/webpagetest/repeatViewServerRTT.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewServerRTTWPT', 'Round Trip Time', - 'Estimated Server Round Trip Time', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.repeatView.results.server_rtt); // jshint ignore:line - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewSpeedIndex.js b/lib/aggregators/webpagetest/repeatViewSpeedIndex.js deleted file mode 100644 index 531380ebd..000000000 --- a/lib/aggregators/webpagetest/repeatViewSpeedIndex.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewSpeedIndexWPT', - 'Speed Index Repeat View', - 'The Speed Index is the average time at which visible parts of the page are displayed. It is expressed in milliseconds and dependent on size of the view port. (fetched using WebPageTest)', - 'timing', '', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.SpeedIndex); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewTTFB.js b/lib/aggregators/webpagetest/repeatViewTTFB.js deleted file mode 100644 index bc0aa2885..000000000 --- a/lib/aggregators/webpagetest/repeatViewTTFB.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewTTFBWPT', - 'TTFB Repeat View', - 'Time To First Byte (fetched using WebPageTest)', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - stats.push(run.repeatView.results.TTFB); - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/repeatViewUserTimings.js b/lib/aggregators/webpagetest/repeatViewUserTimings.js deleted file mode 100644 index c030ff8b2..000000000 --- a/lib/aggregators/webpagetest/repeatViewUserTimings.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Stats = require('fast-stats').Stats; -var util = require('../../util/util'); -var userTimings = {}; - -// The aggregator id is used to print error messages. A better design for 'dynamic' aggregators is needed, -// but this will do for now. -exports.id = 'wptRepeatViewMetrics'; - -exports.processPage = function(pageData) { - if (pageData.webpagetest) { - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (run.repeatView.results.userTimes) { - Object.keys(run.repeatView.results.userTimes).forEach(function(userTiming) { - if (userTimings.hasOwnProperty(userTiming)) { - userTimings[userTiming].push(Number(run.repeatView.results.userTimes[userTiming])); - } else { - userTimings[userTiming] = new Stats().push(Number(run.repeatView.results.userTimes[ - userTiming])); - } - }); - } - - }); - }); - } -}; - - -exports.generateResults = function() { - var keys = Object.keys(userTimings), - result = []; - - for (var i = 0; i < keys.length; i++) { - result.push({ - id: 'repeatView' + keys[i] + 'WPT', - title: keys[i] + ' repeat view', - desc: 'User Timing API metric', - type: 'timing', - stats: util.getStatisticsObject(userTimings[keys[i]], 0), - unit: 'milliseconds' - }); - } - - return result; -}; - -exports.clear = function() { - userTimings = {}; -}; diff --git a/lib/aggregators/webpagetest/repeatViewVisualComplete.js b/lib/aggregators/webpagetest/repeatViewVisualComplete.js deleted file mode 100644 index 9b625d80a..000000000 --- a/lib/aggregators/webpagetest/repeatViewVisualComplete.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) - * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog - * and other contributors - * Released under the Apache 2.0 License - */ -var Aggregator = require('../aggregator'); - -module.exports = new Aggregator('repeatViewVisualCompleteWPT', - 'Visual Complete Repeat View', - 'Time of the last visual change to the page (fetched using WebPageTest).', 'timing', 'milliseconds', 0, - function(pageData) { - if (pageData.webpagetest) { - var stats = this.stats; - pageData.webpagetest.wpt.forEach(function(browserAndLocation) { - browserAndLocation.response.data.run.forEach(function(run) { - if (typeof run.repeatView !== 'undefined') { - stats.push(run.repeatView.results.visualComplete); - } - }); - }); - } - }); diff --git a/lib/aggregators/webpagetest/request.js b/lib/aggregators/webpagetest/request.js new file mode 100644 index 000000000..738c9c5ae --- /dev/null +++ b/lib/aggregators/webpagetest/request.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('requestsWPT', + 'Requests', + 'The number of requests', + 'pagemetric', '', 0, + 'requests'); diff --git a/lib/aggregators/webpagetest/serverRTT.js b/lib/aggregators/webpagetest/serverRTT.js new file mode 100644 index 000000000..e1f390f2f --- /dev/null +++ b/lib/aggregators/webpagetest/serverRTT.js @@ -0,0 +1,13 @@ +/** +* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) +* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog +* and other contributors +* Released under the Apache 2.0 License +*/ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('serverRTTWPT', +'Round Trip Time', +'Estimated Server Round Trip Time', +'timing', 'milliseconds', 0, +'server_rtt'); diff --git a/lib/aggregators/webpagetest/speedIndex.js b/lib/aggregators/webpagetest/speedIndex.js new file mode 100644 index 000000000..f8d277ead --- /dev/null +++ b/lib/aggregators/webpagetest/speedIndex.js @@ -0,0 +1,12 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('speedIndexWPT', + 'Speed Index', + 'The Speed Index is the average time at which visible parts of the page are displayed. It is expressed in milliseconds and dependent on size of the view port. (fetched using WebPageTest)', + 'timing', '', 0,'SpeedIndex'); diff --git a/lib/aggregators/webpagetest/userTimings.js b/lib/aggregators/webpagetest/userTimings.js new file mode 100644 index 000000000..2bc10f63e --- /dev/null +++ b/lib/aggregators/webpagetest/userTimings.js @@ -0,0 +1,18 @@ +/** +* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) +* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog +* and other contributors +* Released under the Apache 2.0 License +*/ +var Stats = require('fast-stats').Stats; +var util = require('../../util/util'); + +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('userTiming', +'userTiming', +'User Timing API metric', 'timing', 'milliseconds', 0, + // special hack for telling the WPTAggregator to fetch + // all the user timings +'USERTIMING' +); diff --git a/lib/aggregators/webpagetest/visualComplete.js b/lib/aggregators/webpagetest/visualComplete.js new file mode 100644 index 000000000..17b86f017 --- /dev/null +++ b/lib/aggregators/webpagetest/visualComplete.js @@ -0,0 +1,13 @@ +/** + * Sitespeed.io - How speedy is your site? (http://www.sitespeed.io) + * Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog + * and other contributors + * Released under the Apache 2.0 License + */ +var WPTAggregator = require('../WPTAggregator'); + +module.exports = new WPTAggregator('visualCompleteWPT', + 'Visual Complete', + 'Time of the last visual change to the page (fetched using WebPageTest).', + 'timing', 'milliseconds', 0, + 'visualComplete');