mreo ui
This commit is contained in:
1 parent
49f9bb3458
commit
7436966689
22 files changed
+989
-125
No files matched your search
+12
-5
@@ -524,16 +524,17 @@
|
||||
requestInit = Object.assign({}, requestInit, { headers: headers });
|
||||
}
|
||||
|
||||
var startedAt = Date.now();
|
||||
return originalFetch.call(global, input, requestInit).then(
|
||||
function (res) {
|
||||
addBreadcrumb('fetch', method + ' ' + url + ' -> ' + res.status);
|
||||
addBreadcrumb('fetch', method + ' ' + url + ' -> ' + res.status, { d: Date.now() - startedAt, tid: requestTraceId });
|
||||
if (reportHttpFailures && res.status >= 400) {
|
||||
httpFailureReport('fetch', method, url, res.status, requestTraceId);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
function (err) {
|
||||
addBreadcrumb('fetch', method + ' ' + url + ' -> error');
|
||||
addBreadcrumb('fetch', method + ' ' + url + ' -> error', { d: Date.now() - startedAt, tid: requestTraceId });
|
||||
if (reportHttpFailures) {
|
||||
httpFailureReport('fetch', method, url, 0, requestTraceId);
|
||||
}
|
||||
@@ -571,12 +572,13 @@
|
||||
global.XMLHttpRequest.prototype.send = function () {
|
||||
var xhr = this;
|
||||
var info = xhr.__rum || {};
|
||||
var xhrStartedAt = Date.now();
|
||||
if (info.url) {
|
||||
var origHandler = xhr.onreadystatechange;
|
||||
xhr.onreadystatechange = function () {
|
||||
try {
|
||||
if (xhr.readyState === 4) {
|
||||
addBreadcrumb('xhr', info.method + ' ' + info.url + ' -> ' + xhr.status);
|
||||
addBreadcrumb('xhr', info.method + ' ' + info.url + ' -> ' + xhr.status, { d: Date.now() - xhrStartedAt, tid: info.traceId });
|
||||
if (reportHttpFailures && (xhr.status === 0 || xhr.status >= 400)) {
|
||||
httpFailureReport('xhr', info.method, info.url, xhr.status, info.traceId);
|
||||
}
|
||||
@@ -644,8 +646,13 @@
|
||||
observeVitals();
|
||||
}
|
||||
|
||||
function addBreadcrumb(category, message) {
|
||||
breadcrumbs.push({ t: Date.now(), category: String(category), message: String(message) });
|
||||
// extra.d = request duration in ms, extra.tid = trace id we sent on the
|
||||
// request. t stays the completion time; the request started at t - d.
|
||||
function addBreadcrumb(category, message, extra) {
|
||||
var crumb = { t: Date.now(), category: String(category), message: String(message) };
|
||||
if (extra && typeof extra.d === 'number') crumb.d = extra.d;
|
||||
if (extra && extra.tid) crumb.tid = String(extra.tid);
|
||||
breadcrumbs.push(crumb);
|
||||
if (breadcrumbs.length > maxBreadcrumbs) {
|
||||
breadcrumbs.shift();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user