-
Notifications
You must be signed in to change notification settings - Fork 672
Fix Bug 1468271, make ie performance metrics more reliable #4935
Fix Bug 1468271, make ie performance metrics more reliable #4935
Conversation
|
You need to add these to Did the husky precommit hook warn you about these? |
Yup, but I wanted to get the PR in for review ;) Still need to update the ignore patterns and update the PR. |
jwhitlock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS Linting should run without errors.
I'm not thrilled with the magic values being used ('ie-load-event-end', 'https://interactive-examples.mdn.mozilla.net') which means I need to have Javascript from both projects loaded into memory to review. I don't have any suggestions at this time for improving it.
This took me some time to get running locally:
- I replaced
https://developer.mozilla.orgwithhttp://localhost:8000injs/editor-libs/analytics.js,js/editor-libs/events.js,js/editor-libs/mce-utils.js, andjs/editor-libs/perf.js. I rannpm run buildto rebuild, andnpm run server-startto run the server. - The enviroment-based configuration for
INTERACTIVE_EXAMPLES_BASEis broken, and needed fixing. - I sprinkled in some
console.loganddebuggerto figure out issues. - I used the non-minified versions of
js/utils/perf.jsandjs/utils/perf-post-message-listener.js. I didn't confirm that the minified versions are the same.
I used the CSS border page, so my events were:
Running command: ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples", timingVar: "ie-time-to-interactive", timingValue: 907.999999995809})
Running command: ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples",
Running command: ga("send", {hitType: "event", eventCategory: "Interactive Examples", eventAction:
Running command: ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar:
Running command: ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar:
I seem to be missing the "Time to iframe fetch start" event and timing. I may be missing something in my local config.
| @@ -0,0 +1 @@ | |||
| function handlePerfMarks(e){e.measureName?(window.mdn.perf.setMark(e.markName),window.mdn.perf.setMeasure({measureName:e.measureName,startMark:e.startMark,endMark:e.endMark}),ga&&ga.create&&ga("send",{hitType:"timing",timingCategory:"RUM - Interactive Examples",timingVar:e.measureName,timingValue:window.mdn.perf.getDuration(e.measureName)||0})):window.mdn.perf.setMark(e.markName)}function perfMsgHandler(e){"use strict";var a=window.mdn.interactiveEditor.editorUrl||"https://interactive-examples.mdn.mozilla.net",r=e.data;if(e.origin!==a)return!1;r.markName&&-1<r.markName.indexOf("interactive-editor-")&&handlePerfMarks(r)}window.addEventListener("message",perfMsgHandler,!1); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this should be called perf-post-message-listener.min.js, since it appears to be the minified version of perf-post-message-listener.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, my bad. You are correct.
I agree that this is a problem. Seeing @hobinjk is actively working on getting this out of the iframe, perhaps this is temporary for now, and not something we need to fix soon?
It may be because this happens in Kuma and is not something sent from the iframe? |
I think it is long overdue to work on this, but not in the context of this PR. There's no deadline for @hobinjk's work, and no guarantee that inlining will be appropriate.
Thanks, that got me to the right place. The issue is that If this is changed to look for |
…4936) This addresses some issues when reviewing PR #4935 and getting my Kuma dev environment to talk to a local checkout of https://github.com/mdn/interactive-examples/ * I gave @schalkneethling the wrong command in #4404 (comment) to override ``INTERACTIVE_EXAMPLES_BASE`` from the environment, this corrects it. * The code that looks for the interactive example iframe events was always looking for the production domain, this changes it to look for ``INTERACTIVE_EXAMPLES_BASE`` via ``mdn.interactiveEditor.editorUrl``.
|
@jwhitlock files added to |
|
@schalkneethling can you match the names of |
Whoops, completely forgot about that. |
|
@jwhitlock Filename updated. |
@jwhitlock I have tested this change with the various editors. I also tested using various connection profiles (Online, Fast 3G, Slow 3G) in combination with 6x CPU throttling.
From my tests I no longer see the error regarding
interactive-editor-loadingmark not existing. I also confirmed between production and local that all GA calls are made, and sent.For the inlined code I also use
ga('send'directly as apposed to the utils inanalytics.js.PRODUCTION
ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples", timingVar: "ie-time-to-interactive", timingValue: 137})ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples", timingVar: "ie-time-to-complete", timingValue: 179})ga("send", {hitType: "event", eventCategory: "Interactive Examples", eventAction: "Time to iframe fetch start", eventLabel: "mtPQN-1534413401413", eventValue: 127, hitCallback: null})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "Time to iframe fetch start", timingValue: 127})ga("send", {hitType: "event", eventCategory: "Interactive Examples", eventAction: "JS editor load time", eventLabel: "2Cxzy-1534413401652", eventValue: 705, hitCallback: null})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "JS editor load time", timingValue: 705})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "js-ie-load-event-end-measure", timingValue: 1040})LOCAL
ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples", timingVar: "ie-time-to-interactive", timingValue: 191})ga("send", {hitType: "event", eventCategory: "Interactive Examples", eventAction: "Time to iframe fetch start", eventLabel: "wz1no-1534412668571", eventValue: 340, hitCallback: null})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "Time to iframe fetch start", timingValue: 340})ga("send", {hitType: "timing", timingCategory: "RUM - Interactive Examples", timingVar: "ie-time-to-complete", timingValue: 253})ga("send", {hitType: "event", eventCategory: "Interactive Examples", eventAction: "JS editor load time", eventLabel: "ihxea-1534412668872", eventValue: 1079, hitCallback: null})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "JS editor load time", timingValue: 1079})ga("send", {hitType: "timing", timingCategory: "Interactive Examples", timingVar: "js-ie-load-event-end-measure", timingValue: 1398})Let me know if you find anything that does not match our expectation. Thanks!