perfops-rom
Advanced tools
Comparing version 1.1.2 to 1.1.3
187
dist/rom.js
"use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
(function (Promise) { | ||
var API_URL = 'https://devnull.perfops.net/rum/v1'; | ||
var API_URL = 'https://devnull.perfops.net'; | ||
var RESOURCES_URL = 'https://api.perfops.net/rum-cdn.php'; | ||
@@ -10,2 +22,4 @@ var RESOURCES_TTL = 5 * 60 * 1000; // Resources list TTL in the LocalStorage | ||
var STORE_DATA_INTERVAL = 1000; // How often we should try to send data to the rum-parser | ||
var QUEUE_LIMIT = 3; | ||
@@ -28,3 +42,3 @@ | ||
function formatTiming(value) { | ||
return Math.min(0, Number(value.toFixed(2))); | ||
return Math.max(0, Number(value.toFixed(2))); | ||
} | ||
@@ -148,18 +162,30 @@ | ||
"data": [{ | ||
"id": 6, | ||
"cdnUrl": "https://perfops-ade2.kxcdn.com/500b-bench.jpg", | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"id": 30, | ||
"cdnUrl": "https://perfops.doracdn.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/5002b-bench.jpg", | ||
"id": 2, | ||
"cdnUrl": "https://ovhcdn.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 29, | ||
"cdnUrl": "https://25748s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 11, | ||
@@ -173,8 +199,8 @@ "cdnUrl": "https://perfops.b-cdn.net/500b-bench.jpg", | ||
}, { | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 9, | ||
"cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 2, | ||
"cdnUrl": "https://ovhcdn.perfstack.net/500b-bench.jpg", | ||
"id": 6, | ||
"cdnUrl": "https://perfops-ade2.kxcdn.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -186,16 +212,16 @@ }, { | ||
}, { | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"id": 15, | ||
"cdnUrl": "https://cdnperf-rum.cdnetworks.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 29, | ||
"cdnUrl": "https://25748s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "0" | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/5002b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
@@ -207,18 +233,14 @@ }, { | ||
}, { | ||
"id": 20, | ||
"cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 9, | ||
"cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 15, | ||
"cdnUrl": "https://cdnperf-rum.cdnetworks.net/500b-bench.jpg", | ||
"id": 20, | ||
"cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 18, | ||
@@ -228,9 +250,5 @@ "cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}] | ||
@@ -257,3 +275,3 @@ }; | ||
if (Math.random() < 1 / oneIn) { | ||
fetch('https://devnull.perfops.net/debug/log', { | ||
fetch("".concat(API_URL, "/debug/log"), { | ||
data: JSON.stringify(data), | ||
@@ -276,10 +294,59 @@ method: 'POST' | ||
function run() { | ||
var results = []; | ||
var metadata = { | ||
ua: navigator.userAgent, | ||
hostname: window.location.hostname, | ||
client: clientKey | ||
}; | ||
var storeInterval; | ||
var finished = false; | ||
var store = function store() { | ||
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
logInfo("Try to store ".concat(results.length, " items")); | ||
if (finished && results.length === 0) { | ||
logInfo('Store data interval cleared'); | ||
clearInterval(storeInterval); | ||
} | ||
if (results.length < 1) { | ||
logInfo('Batch is empty'); | ||
return; | ||
} | ||
if (results.length < 3 && !force) { | ||
logInfo('Batch is to small. Wait for more results'); | ||
return; | ||
} | ||
var slow = results.reduce(function (ac, val) { | ||
return ac + (val.time > 2000 ? 1 : 0); | ||
}, 0); // All the measurements in a batch are slow. Probably something with a user's internet connection. Skip the batch. | ||
if (slow === results.length) { | ||
logInfo("Skip batch of a ".concat(slow, " slow probes")); | ||
results.splice(0, slow); | ||
return; | ||
} | ||
storeResults(metadata, results.splice(0, results.length)).then(function () { | ||
return logInfo("Results stored"); | ||
}).catch(function (data) { | ||
var _results; | ||
return (_results = results).push.apply(_results, _toConsumableArray(data)); | ||
}); | ||
}; | ||
var processor = function processor() { | ||
finished = false; // Clean up before new run. | ||
clearInterval(storeInterval); // Clear previous interval | ||
results = []; // Remove outdated probe results if they aren't stored till now. | ||
storeInterval = setInterval(store, STORE_DATA_INTERVAL); // Set new interval for data storing | ||
fetchResourceList().then(function (response) { | ||
var metadata = { | ||
ua: navigator.userAgent, | ||
hostname: window.location.hostname, | ||
client: clientKey | ||
}; | ||
var chunkedData = function (array, n) { | ||
@@ -292,6 +359,3 @@ return Array.from(Array(Math.ceil(array.length / n)), function (_, i) { | ||
return pMapSeries(chunkedData, function (resources) { | ||
var results = []; | ||
var tooSlow = 0; | ||
var down = 0; | ||
performance.clearResourceTimings(); | ||
return Promise.all(resources.map(function (resource) { | ||
@@ -301,4 +365,2 @@ return fetchResource(resource).then(function (data) { | ||
down++; | ||
} else if (data.time > 2000) { | ||
tooSlow++; | ||
} // time must be between 3 and 3000 ms | ||
@@ -312,14 +374,3 @@ // if 2 or more providers in one batch fail, drop all results | ||
if (results.push(data) >= QUEUE_LIMIT) { | ||
down = 0; | ||
if (tooSlow < QUEUE_LIMIT) { | ||
tooSlow = 0; | ||
} else { | ||
tooSlow = 0; | ||
return results.splice(0, results.length); | ||
} | ||
return storeResults(metadata, results.splice(0, results.length)); | ||
} | ||
results.push(data); | ||
}); | ||
@@ -329,2 +380,5 @@ })); | ||
}).then(logInfo, logError).then(function () { | ||
finished = true; | ||
store(true); | ||
}).then(function () { | ||
return setTimeout(processor, REPEAT_DELAY); | ||
@@ -339,3 +393,3 @@ }); | ||
function storeResults(metadata, data) { | ||
return fetch(API_URL, { | ||
return fetch("".concat(API_URL, "/rum/v1"), { | ||
data: JSON.stringify({ | ||
@@ -346,3 +400,6 @@ metadata: metadata, | ||
method: 'POST' | ||
}).catch(logError); | ||
}).catch(function (err) { | ||
logError(err); | ||
throw data; | ||
}); | ||
} | ||
@@ -349,0 +406,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(a){var n,c="https://devnull.perfops.net/rum/v1",t="https://api.perfops.net/rum-cdn.php",r=3e5,e=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},o=e.logInfo,u=e.logError,i=window.rum?window.rum.key:void 0;function d(n){return Math.min(0,Number(n.toFixed(2)))}function p(r,n){var e=1<arguments.length&&void 0!==n?n:{},t=e.cb,o=void 0===t?function(){}:t,c=e.data,i=e.method,s=void 0===i?"GET":i,d=e.timeout,p=void 0===d?3e3:d;return new a(function(n,e){var t=new XMLHttpRequest;t.onload=function(){return n(t)},t.onerror=t.ontimeout=function(){u(t),e(new Error("Status ".concat(t.status,". Response: ").concat(t.statusText)))},t.open(s,r),t.timeout=p,o(t),t.send(c)})}function s(){setTimeout(function n(){(function(){var e="perfops-rum-resources",n=JSON.parse(window.localStorage.getItem(e));return n&&n.expiry>Date.now()?a.resolve(n.data):p(t).then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return window.localStorage.setItem(e,JSON.stringify({data:n.data,expiry:Date.now()+r})),n.data}).catch(function(){return{data:[{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/5002b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"0"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:29,cdnUrl:"https://25748s.ha.azioncdn.net/500b-bench.jpg",p:"0"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"}]}})})().then(function(n){var t,o={ua:navigator.userAgent,hostname:window.location.hostname,client:i};return function(n,r){return n.reduce(function(n,t){return n.then(function(e){return r(t).then(function(n){return e.push(n),e})})},a.resolve([]))}((t=n,Array.from(Array(Math.ceil(t.length/3)),function(n,e){return t.slice(3*e,3*e+3)})),function(n){var e=[],t=0,r=0;return performance.clearResourceTimings(),a.all(n.map(function(n){return function(i){var s="".concat(i.cdnUrl,"?t=").concat(Date.now());return p(s).then(function(n){var e=performance.getEntriesByName(s)[0],t={id:i.id},r=d(e.domainLookupEnd-e.domainLookupStart),o=d(e.connectEnd-e.connectStart),c=0<o?d(e.connectEnd-e.secureConnectionStart):0;return 200<=n.status&&n.status<300&&(t=Object.assign({},t,{up:1,time:Number((e.responseEnd-e.requestStart).toFixed(2)),dnsLookupTime:r,tcpTime:o,sslTime:c,headers:n.getAllResponseHeaders()})),300<=n.status&&n.status<=500&&(t=Object.assign({},t,{up:0,dnsLookupTime:r,tcpTime:o,sslTime:c,headers:n.getAllResponseHeaders()})),t}).catch(function(){return{id:i.id,up:0}})}(n).then(function(n){if(n.up?2e3<n.time&&t++:r++,!(1<r||n.up&&(n.time<3||3e3<n.time)))return 3<=e.push(n)?(r=0,t<3?(t=0,function(n,e){return p(c,{data:JSON.stringify({metadata:n,data:e}),method:"POST"}).catch(u)}(o,e.splice(0,e.length))):(t=0,e.splice(0,e.length))):void 0})}))})}).then(o,u).then(function(){return setTimeout(n,6e4)})},1e3)}n=function(){var n=["bot","headless","google","baidu","bing","msn","duckduckbot","teoma","slurp","yandex","phantomjs","pingdom","ahrefsbot"].join("|");if(new RegExp(n,"i").test(window.navigator.userAgent))console.warn("PerfOps RUM not launching due to suspicious userAgent:",window.navigator.userAgent);else if(void 0!==window.performance){if(performance.onresourcetimingbufferfull=function(){o("clear performance resource buffer"),performance.clearResourceTimings()},"function"==typeof a)return s();!function(n,e){var t,r=document.createElement("script");r.onreadystatechange=r.onload=function(){t||e(),t=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){a=window.ES6Promise,s()})}},"complete"===document.readyState?n():window.addEventListener("load",n)}(window.Promise); | ||
"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(d){var e,i="https://devnull.perfops.net",n="https://api.perfops.net/rum-cdn.php",s=3e5,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},p=t.logInfo,u=t.logError,l=window.rum?window.rum.key:void 0;function f(e){return Math.max(0,Number(e.toFixed(2)))}function h(r,e){var t=1<arguments.length&&void 0!==e?e:{},n=t.cb,o=void 0===n?function(){}:n,c=t.data,a=t.method,i=void 0===a?"GET":a,s=t.timeout,p=void 0===s?3e3:s;return new d(function(e,t){var n=new XMLHttpRequest;n.onload=function(){return e(n)},n.onerror=n.ontimeout=function(){u(n),t(new Error("Status ".concat(n.status,". Response: ").concat(n.statusText)))},n.open(i,r),n.timeout=p,o(n),n.send(c)})}function r(){function t(e){var t=0<arguments.length&&void 0!==e&&e;if(p("Try to store ".concat(o.length," items")),a&&0===o.length&&(p("Store data interval cleared"),clearInterval(r)),o.length<1)p("Batch is empty");else if(o.length<3&&!t)p("Batch is to small. Wait for more results");else{var n=o.reduce(function(e,t){return e+(2e3<t.time?1:0)},0);if(n===o.length)return p("Skip batch of a ".concat(n," slow probes")),void o.splice(0,n);(function(e,t){return h("".concat(i,"/rum/v1"),{data:JSON.stringify({metadata:e,data:t}),method:"POST"}).catch(function(e){throw u(e),t})})(c,o.splice(0,o.length)).then(function(){return p("Results stored")}).catch(function(e){var t;return(t=o).push.apply(t,_toConsumableArray(e))})}}var r,o=[],c={ua:navigator.userAgent,hostname:window.location.hostname,client:l},a=!1;setTimeout(function e(){a=!1,clearInterval(r),o=[],r=setInterval(t,1e3),function(){var t="perfops-rum-resources",e=JSON.parse(window.localStorage.getItem(t));return e&&e.expiry>Date.now()?d.resolve(e.data):h(n).then(function(e){return JSON.parse(e.response)}).then(function(e){if(!e||!e.data||!e.data.length)throw new Error("Empty response.data");return window.localStorage.setItem(t,JSON.stringify({data:e.data,expiry:Date.now()+s})),e.data}).catch(function(){return{data:[{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:30,cdnUrl:"https://perfops.doracdn.com/500b-bench.jpg",p:"0"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:29,cdnUrl:"https://25748s.ha.azioncdn.net/500b-bench.jpg",p:"0"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"0"},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/5002b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"}]}})}().then(function(e){var n;return function(e,r){return e.reduce(function(e,n){return e.then(function(t){return r(n).then(function(e){return t.push(e),t})})},d.resolve([]))}((n=e,Array.from(Array(Math.ceil(n.length/3)),function(e,t){return n.slice(3*t,3*t+3)})),function(e){var t=0;return d.all(e.map(function(e){return function(a){var i="".concat(a.cdnUrl,"?t=").concat(Date.now());return h(i).then(function(e){var t=performance.getEntriesByName(i)[0],n={id:a.id},r=f(t.domainLookupEnd-t.domainLookupStart),o=f(t.connectEnd-t.connectStart),c=0<o?f(t.connectEnd-t.secureConnectionStart):0;return 200<=e.status&&e.status<300&&(n=Object.assign({},n,{up:1,time:Number((t.responseEnd-t.requestStart).toFixed(2)),dnsLookupTime:r,tcpTime:o,sslTime:c,headers:e.getAllResponseHeaders()})),300<=e.status&&e.status<=500&&(n=Object.assign({},n,{up:0,dnsLookupTime:r,tcpTime:o,sslTime:c,headers:e.getAllResponseHeaders()})),n}).catch(function(){return{id:a.id,up:0}})}(e).then(function(e){e.up||t++,1<t||e.up&&(e.time<3||3e3<e.time)||o.push(e)})}))})}).then(p,u).then(function(){t(a=!0)}).then(function(){return setTimeout(e,6e4)})},1e3)}e=function(){var e=["bot","headless","google","baidu","bing","msn","duckduckbot","teoma","slurp","yandex","phantomjs","pingdom","ahrefsbot"].join("|");if(new RegExp(e,"i").test(window.navigator.userAgent))console.warn("PerfOps RUM not launching due to suspicious userAgent:",window.navigator.userAgent);else if(void 0!==window.performance){if(performance.onresourcetimingbufferfull=function(){p("clear performance resource buffer"),performance.clearResourceTimings()},"function"==typeof d)return r();!function(e,t){var n,r=document.createElement("script");r.onreadystatechange=r.onload=function(){n||t(),n=!0},r.setAttribute("src",e),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){d=window.ES6Promise,r()})}},"complete"===document.readyState?e():window.addEventListener("load",e)}(window.Promise); |
187
dist/rom3.js
"use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
(function (Promise) { | ||
var API_URL = 'https://devnull.perfops.net/rum/v1'; | ||
var API_URL = 'https://devnull.perfops.net'; | ||
var RESOURCES_URL = 'https://api.perfops.net/rum-cdn.php'; | ||
@@ -10,2 +22,4 @@ var RESOURCES_TTL = 5 * 60 * 1000; // Resources list TTL in the LocalStorage | ||
var STORE_DATA_INTERVAL = 1000; // How often we should try to send data to the rum-parser | ||
var QUEUE_LIMIT = 3; | ||
@@ -28,3 +42,3 @@ | ||
function formatTiming(value) { | ||
return Math.min(0, Number(value.toFixed(2))); | ||
return Math.max(0, Number(value.toFixed(2))); | ||
} | ||
@@ -148,18 +162,30 @@ | ||
"data": [{ | ||
"id": 6, | ||
"cdnUrl": "https://perfops-ade2.kxcdn.com/500b-bench.jpg", | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"id": 30, | ||
"cdnUrl": "https://perfops.doracdn.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/5002b-bench.jpg", | ||
"id": 2, | ||
"cdnUrl": "https://ovhcdn.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 29, | ||
"cdnUrl": "https://25748s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 11, | ||
@@ -173,8 +199,8 @@ "cdnUrl": "https://perfops.b-cdn.net/500b-bench.jpg", | ||
}, { | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 9, | ||
"cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 2, | ||
"cdnUrl": "https://ovhcdn.perfstack.net/500b-bench.jpg", | ||
"id": 6, | ||
"cdnUrl": "https://perfops-ade2.kxcdn.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -186,16 +212,16 @@ }, { | ||
}, { | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"id": 15, | ||
"cdnUrl": "https://cdnperf-rum.cdnetworks.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 29, | ||
"cdnUrl": "https://25748s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "0" | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/5002b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
@@ -207,18 +233,14 @@ }, { | ||
}, { | ||
"id": 20, | ||
"cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 9, | ||
"cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 15, | ||
"cdnUrl": "https://cdnperf-rum.cdnetworks.net/500b-bench.jpg", | ||
"id": 20, | ||
"cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 18, | ||
@@ -228,9 +250,5 @@ "cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}] | ||
@@ -257,3 +275,3 @@ }; | ||
if (Math.random() < 1 / oneIn) { | ||
fetch('https://devnull.perfops.net/debug/log', { | ||
fetch("".concat(API_URL, "/debug/log"), { | ||
data: JSON.stringify(data), | ||
@@ -276,10 +294,59 @@ method: 'POST' | ||
function run() { | ||
var results = []; | ||
var metadata = { | ||
ua: navigator.userAgent, | ||
hostname: window.location.hostname, | ||
client: clientKey | ||
}; | ||
var storeInterval; | ||
var finished = false; | ||
var store = function store() { | ||
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
logInfo("Try to store ".concat(results.length, " items")); | ||
if (finished && results.length === 0) { | ||
logInfo('Store data interval cleared'); | ||
clearInterval(storeInterval); | ||
} | ||
if (results.length < 1) { | ||
logInfo('Batch is empty'); | ||
return; | ||
} | ||
if (results.length < 3 && !force) { | ||
logInfo('Batch is to small. Wait for more results'); | ||
return; | ||
} | ||
var slow = results.reduce(function (ac, val) { | ||
return ac + (val.time > 2000 ? 1 : 0); | ||
}, 0); // All the measurements in a batch are slow. Probably something with a user's internet connection. Skip the batch. | ||
if (slow === results.length) { | ||
logInfo("Skip batch of a ".concat(slow, " slow probes")); | ||
results.splice(0, slow); | ||
return; | ||
} | ||
storeResults(metadata, results.splice(0, results.length)).then(function () { | ||
return logInfo("Results stored"); | ||
}).catch(function (data) { | ||
var _results; | ||
return (_results = results).push.apply(_results, _toConsumableArray(data)); | ||
}); | ||
}; | ||
var processor = function processor() { | ||
finished = false; // Clean up before new run. | ||
clearInterval(storeInterval); // Clear previous interval | ||
results = []; // Remove outdated probe results if they aren't stored till now. | ||
storeInterval = setInterval(store, STORE_DATA_INTERVAL); // Set new interval for data storing | ||
fetchResourceList().then(function (response) { | ||
var metadata = { | ||
ua: navigator.userAgent, | ||
hostname: window.location.hostname, | ||
client: clientKey | ||
}; | ||
var chunkedData = function (array, n) { | ||
@@ -292,6 +359,3 @@ return Array.from(Array(Math.ceil(array.length / n)), function (_, i) { | ||
return pMapSeries(chunkedData, function (resources) { | ||
var results = []; | ||
var tooSlow = 0; | ||
var down = 0; | ||
performance.clearResourceTimings(); | ||
return Promise.all(resources.map(function (resource) { | ||
@@ -301,4 +365,2 @@ return fetchResource(resource).then(function (data) { | ||
down++; | ||
} else if (data.time > 2000) { | ||
tooSlow++; | ||
} // time must be between 3 and 3000 ms | ||
@@ -312,14 +374,3 @@ // if 2 or more providers in one batch fail, drop all results | ||
if (results.push(data) >= QUEUE_LIMIT) { | ||
down = 0; | ||
if (tooSlow < QUEUE_LIMIT) { | ||
tooSlow = 0; | ||
} else { | ||
tooSlow = 0; | ||
return results.splice(0, results.length); | ||
} | ||
return storeResults(metadata, results.splice(0, results.length)); | ||
} | ||
results.push(data); | ||
}); | ||
@@ -329,2 +380,5 @@ })); | ||
}).then(logInfo, logError).then(function () { | ||
finished = true; | ||
store(true); | ||
}).then(function () { | ||
return setTimeout(processor, REPEAT_DELAY); | ||
@@ -339,3 +393,3 @@ }); | ||
function storeResults(metadata, data) { | ||
return fetch(API_URL, { | ||
return fetch("".concat(API_URL, "/rum/v1"), { | ||
data: JSON.stringify({ | ||
@@ -346,3 +400,6 @@ metadata: metadata, | ||
method: 'POST' | ||
}).catch(logError); | ||
}).catch(function (err) { | ||
logError(err); | ||
throw data; | ||
}); | ||
} | ||
@@ -349,0 +406,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(a){var n,c="https://devnull.perfops.net/rum/v1",t="https://api.perfops.net/rum-cdn.php",r=3e5,e=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},o=e.logInfo,u=e.logError,i=window.rum?window.rum.key:void 0;function d(n){return Math.min(0,Number(n.toFixed(2)))}function p(r,n){var e=1<arguments.length&&void 0!==n?n:{},t=e.cb,o=void 0===t?function(){}:t,c=e.data,i=e.method,s=void 0===i?"GET":i,d=e.timeout,p=void 0===d?3e3:d;return new a(function(n,e){var t=new XMLHttpRequest;t.onload=function(){return n(t)},t.onerror=t.ontimeout=function(){u(t),e(new Error("Status ".concat(t.status,". Response: ").concat(t.statusText)))},t.open(s,r),t.timeout=p,o(t),t.send(c)})}function s(){setTimeout(function n(){(function(){var e="perfops-rum-resources",n=JSON.parse(window.localStorage.getItem(e));return n&&n.expiry>Date.now()?a.resolve(n.data):p(t).then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return window.localStorage.setItem(e,JSON.stringify({data:n.data,expiry:Date.now()+r})),n.data}).catch(function(){return{data:[{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/5002b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"0"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:29,cdnUrl:"https://25748s.ha.azioncdn.net/500b-bench.jpg",p:"0"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"}]}})})().then(function(n){var t,o={ua:navigator.userAgent,hostname:window.location.hostname,client:i};return function(n,r){return n.reduce(function(n,t){return n.then(function(e){return r(t).then(function(n){return e.push(n),e})})},a.resolve([]))}((t=n,Array.from(Array(Math.ceil(t.length/3)),function(n,e){return t.slice(3*e,3*e+3)})),function(n){var e=[],t=0,r=0;return performance.clearResourceTimings(),a.all(n.map(function(n){return function(i){var s="".concat(i.cdnUrl,"?t=").concat(Date.now());return p(s).then(function(n){var e=performance.getEntriesByName(s)[0],t={id:i.id},r=d(e.domainLookupEnd-e.domainLookupStart),o=d(e.connectEnd-e.connectStart),c=0<o?d(e.connectEnd-e.secureConnectionStart):0;return 200<=n.status&&n.status<300&&(t=Object.assign({},t,{up:1,time:Number((e.responseEnd-e.requestStart).toFixed(2)),dnsLookupTime:r,tcpTime:o,sslTime:c,headers:n.getAllResponseHeaders()})),300<=n.status&&n.status<=500&&(t=Object.assign({},t,{up:0,dnsLookupTime:r,tcpTime:o,sslTime:c,headers:n.getAllResponseHeaders()})),t}).catch(function(){return{id:i.id,up:0}})}(n).then(function(n){if(n.up?2e3<n.time&&t++:r++,!(1<r||n.up&&(n.time<3||3e3<n.time)))return 3<=e.push(n)?(r=0,t<3?(t=0,function(n,e){return p(c,{data:JSON.stringify({metadata:n,data:e}),method:"POST"}).catch(u)}(o,e.splice(0,e.length))):(t=0,e.splice(0,e.length))):void 0})}))})}).then(o,u).then(function(){return setTimeout(n,6e4)})},3e3)}n=function(){var n=["bot","headless","google","baidu","bing","msn","duckduckbot","teoma","slurp","yandex","phantomjs","pingdom","ahrefsbot"].join("|");if(new RegExp(n,"i").test(window.navigator.userAgent))console.warn("PerfOps RUM not launching due to suspicious userAgent:",window.navigator.userAgent);else if(void 0!==window.performance){if(performance.onresourcetimingbufferfull=function(){o("clear performance resource buffer"),performance.clearResourceTimings()},"function"==typeof a)return s();!function(n,e){var t,r=document.createElement("script");r.onreadystatechange=r.onload=function(){t||e(),t=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){a=window.ES6Promise,s()})}},"complete"===document.readyState?n():window.addEventListener("load",n)}(window.Promise); | ||
"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(d){var e,i="https://devnull.perfops.net",n="https://api.perfops.net/rum-cdn.php",s=3e5,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},p=t.logInfo,u=t.logError,l=window.rum?window.rum.key:void 0;function f(e){return Math.max(0,Number(e.toFixed(2)))}function h(r,e){var t=1<arguments.length&&void 0!==e?e:{},n=t.cb,o=void 0===n?function(){}:n,c=t.data,a=t.method,i=void 0===a?"GET":a,s=t.timeout,p=void 0===s?3e3:s;return new d(function(e,t){var n=new XMLHttpRequest;n.onload=function(){return e(n)},n.onerror=n.ontimeout=function(){u(n),t(new Error("Status ".concat(n.status,". Response: ").concat(n.statusText)))},n.open(i,r),n.timeout=p,o(n),n.send(c)})}function r(){function t(e){var t=0<arguments.length&&void 0!==e&&e;if(p("Try to store ".concat(o.length," items")),a&&0===o.length&&(p("Store data interval cleared"),clearInterval(r)),o.length<1)p("Batch is empty");else if(o.length<3&&!t)p("Batch is to small. Wait for more results");else{var n=o.reduce(function(e,t){return e+(2e3<t.time?1:0)},0);if(n===o.length)return p("Skip batch of a ".concat(n," slow probes")),void o.splice(0,n);(function(e,t){return h("".concat(i,"/rum/v1"),{data:JSON.stringify({metadata:e,data:t}),method:"POST"}).catch(function(e){throw u(e),t})})(c,o.splice(0,o.length)).then(function(){return p("Results stored")}).catch(function(e){var t;return(t=o).push.apply(t,_toConsumableArray(e))})}}var r,o=[],c={ua:navigator.userAgent,hostname:window.location.hostname,client:l},a=!1;setTimeout(function e(){a=!1,clearInterval(r),o=[],r=setInterval(t,1e3),function(){var t="perfops-rum-resources",e=JSON.parse(window.localStorage.getItem(t));return e&&e.expiry>Date.now()?d.resolve(e.data):h(n).then(function(e){return JSON.parse(e.response)}).then(function(e){if(!e||!e.data||!e.data.length)throw new Error("Empty response.data");return window.localStorage.setItem(t,JSON.stringify({data:e.data,expiry:Date.now()+s})),e.data}).catch(function(){return{data:[{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:30,cdnUrl:"https://perfops.doracdn.com/500b-bench.jpg",p:"0"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:29,cdnUrl:"https://25748s.ha.azioncdn.net/500b-bench.jpg",p:"0"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"0"},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/5002b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"}]}})}().then(function(e){var n;return function(e,r){return e.reduce(function(e,n){return e.then(function(t){return r(n).then(function(e){return t.push(e),t})})},d.resolve([]))}((n=e,Array.from(Array(Math.ceil(n.length/3)),function(e,t){return n.slice(3*t,3*t+3)})),function(e){var t=0;return d.all(e.map(function(e){return function(a){var i="".concat(a.cdnUrl,"?t=").concat(Date.now());return h(i).then(function(e){var t=performance.getEntriesByName(i)[0],n={id:a.id},r=f(t.domainLookupEnd-t.domainLookupStart),o=f(t.connectEnd-t.connectStart),c=0<o?f(t.connectEnd-t.secureConnectionStart):0;return 200<=e.status&&e.status<300&&(n=Object.assign({},n,{up:1,time:Number((t.responseEnd-t.requestStart).toFixed(2)),dnsLookupTime:r,tcpTime:o,sslTime:c,headers:e.getAllResponseHeaders()})),300<=e.status&&e.status<=500&&(n=Object.assign({},n,{up:0,dnsLookupTime:r,tcpTime:o,sslTime:c,headers:e.getAllResponseHeaders()})),n}).catch(function(){return{id:a.id,up:0}})}(e).then(function(e){e.up||t++,1<t||e.up&&(e.time<3||3e3<e.time)||o.push(e)})}))})}).then(p,u).then(function(){t(a=!0)}).then(function(){return setTimeout(e,6e4)})},3e3)}e=function(){var e=["bot","headless","google","baidu","bing","msn","duckduckbot","teoma","slurp","yandex","phantomjs","pingdom","ahrefsbot"].join("|");if(new RegExp(e,"i").test(window.navigator.userAgent))console.warn("PerfOps RUM not launching due to suspicious userAgent:",window.navigator.userAgent);else if(void 0!==window.performance){if(performance.onresourcetimingbufferfull=function(){p("clear performance resource buffer"),performance.clearResourceTimings()},"function"==typeof d)return r();!function(e,t){var n,r=document.createElement("script");r.onreadystatechange=r.onload=function(){n||t(),n=!0},r.setAttribute("src",e),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){d=window.ES6Promise,r()})}},"complete"===document.readyState?e():window.addEventListener("load",e)}(window.Promise); |
{ | ||
"name": "perfops-rom", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"jsdelivr": "./dist/rom3.min.js", | ||
@@ -5,0 +5,0 @@ "description": "RUM code for https://perfops.net/", |
42799
736