simplified creation of wpt metric #546
This commit is contained in:
parent
9095c21739
commit
a986973df4
|
|
@ -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');
|
||||
|
|
@ -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'
|
||||
);
|
||||
|
|
@ -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');
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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 = {};
|
||||
};
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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'
|
||||
);
|
||||
|
|
@ -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'
|
||||
);
|
||||
|
|
@ -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');
|
||||
|
|
@ -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');
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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 = {};
|
||||
};
|
||||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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');
|
||||
|
|
@ -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');
|
||||
|
|
@ -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');
|
||||
|
|
@ -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'
|
||||
);
|
||||
|
|
@ -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');
|
||||
Loading…
Reference in New Issue