feat(metrics): emit flow events for key performance metrics #4776
Conversation
| @@ -44,6 +44,10 @@ const UTM_PATTERN = /^[\w.%-]+$/; | |||
|
|
|||
| const IS_DISABLED = config.get('client_metrics').stderr_collector_disabled; | |||
|
|
|||
| const PERFORMANCE_PROPERTIES = new Set([ | |||
| 'responseStart', 'domInteractive', 'domComplete', 'loadEventEnd' | |||
shane-tomlinson
Mar 2, 2017
Member
Another performance related event that might be useful, even though it's not an official navigationTiming stat, is loaded. loaded is emit after the first view is visible, meaning it happens after all JS, CSS, HTML is downloaded (unless done using requireOnDemand) and after any XHR requests to determine the user's auth status have completed.
Another performance related event that might be useful, even though it's not an official navigationTiming stat, is loaded. loaded is emit after the first view is visible, meaning it happens after all JS, CSS, HTML is downloaded (unless done using requireOnDemand) and after any XHR requests to determine the user's auth status have completed.
| PERFORMANCE_PROPERTIES.forEach(key => { | ||
| const timing = navigationTiming[key]; | ||
| if (timing > 0) { | ||
| const offset = timing - navigationTiming.navigationStart; |
shane-tomlinson
Mar 2, 2017
Member
One thing to watch out for, I believe these values can be null or undefined. I have performance timing disabled to give sites one less way to fingerprint me.
One thing to watch out for, I believe these values can be null or undefined. I have performance timing disabled to give sites one less way to fingerprint me.
shane-tomlinson
Mar 2, 2017
Member
Also, I think all these values are already offsets, can you verify that?
Also, I think all these values are already offsets, can you verify that?
philbooth
Mar 2, 2017
•
Author
Contributor
One thing to watch out for, I believe these values can be null or undefined.
That's (one of the reasons) why I test timing > 0 above. It's fine that we won't have this data for all flows, I see it more as an additional, secondary datapoint for us to consult when trying to understand certain trends.
I think all these values are already offsets
I copied the subtraction of navigationStart from MDN. Although they're certainly offsets in current Firefox, I don't know if that's always been/will be true across all user agents. I figured the subtraction was there to provide a measure of robustness against implementation differences (including historical ones).
One thing to watch out for, I believe these values can be
nullorundefined.
That's (one of the reasons) why I test timing > 0 above. It's fine that we won't have this data for all flows, I see it more as an additional, secondary datapoint for us to consult when trying to understand certain trends.
I think all these values are already offsets
I copied the subtraction of navigationStart from MDN. Although they're certainly offsets in current Firefox, I don't know if that's always been/will be true across all user agents. I figured the subtraction was there to provide a measure of robustness against implementation differences (including historical ones).
| // | ||
| // Bear this in mind when looking at the data. The main `flow.performance` | ||
| // event represents our best approximation of overall, user-perceived | ||
| // performance. |
philbooth
Mar 3, 2017
Author
Contributor
I'll also add appropriate comments to the flow event docs in the auth server, if/when this gets merged.
I'll also add appropriate comments to the flow event docs in the auth server, if/when this gets merged.
|
@shane-tomlinson, I've re-thought this in light of our conversation in IRC. When you have a moment, please take a look. |
|
|
Fixes mozilla/fxa-activity-metrics#52.
@mozilla/fxa-devs r?