Skip to content

fix(performance): send post to kuma for custom ie-load-event-end metric #1001

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/editable-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
'CSS editor load time',
performance.timing.loadEventEnd
);
// Posts mark to set on the Kuma side and used in measure
mceUtils.postToKuma({ markName: 'css-ie-load-event-end' });
}, 100);
}
});
Expand Down
3 changes: 3 additions & 0 deletions js/editable-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
var featureDetector = require('./editor-libs/feature-detector.js');
var mceConsole = require('./editor-libs/console');
var mceEvents = require('./editor-libs/events.js');
var mceUtils = require('./editor-libs/mce-utils');

var codeBlock = document.getElementById('static-js');
var exampleFeature = codeBlock.dataset['feature'];
Expand Down Expand Up @@ -116,6 +117,8 @@
'JS editor load time',
performance.timing.loadEventEnd
);
// Posts mark to set on the Kuma side and used in measure
mceUtils.postToKuma({ markName: 'js-ie-load-event-end' });
}, 300);
}
});
Expand Down
8 changes: 8 additions & 0 deletions js/editor-libs/mce-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ module.exports = {

return tmpElem.style[property] !== undefined;
},
/**
* Posts a name to set as a mark to Kuma for
* processing and beaconing to GA
* @param {Object} perf - The performance object sent to Kuma
*/
postToKuma: function(perf) {
window.parent.postMessage(perf, 'https://developer.mozilla.org');
},
/**
* Hides the default example and shows the custom block
* @param {object} customBlock - The HTML section to show
Expand Down
3 changes: 3 additions & 0 deletions js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var mceEvents = require('./editor-libs/events.js');
var mceUtils = require('./editor-libs/mce-utils');
var shadowOutput = require('./editor-libs/shadow-output');
var templateUtils = require('./editor-libs/template-utils');
var tabby = require('./editor-libs/tabby');
Expand Down Expand Up @@ -143,6 +144,8 @@
'Tabbed editor load time',
performance.timing.loadEventEnd
);
// Posts mark to set on the Kuma side and used in measure
mceUtils.postToKuma({ markName: 'tabbed-ie-load-event-end' });
}, 100);
}
});
Expand Down