Bug 1405585 - Add telemetry to watch inspector delay between new-root event and full update. r=jdescottes datareview=francois
MozReview-Commit-ID: 5cWcTxPvDKF
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -843,16 +843,19 @@ Inspector.prototype = {
this.eyeDropperButton = null;
}
},
/**
* Reset the inspector on new root mutation.
*/
onNewRoot: function () {
+ // Record new-root timing for telemetry
+ this._newRootStart = this.panelWin.performance.now();
+
this._defaultNode = null;
this.selection.setNodeFront(null);
this._destroyMarkup();
this.isDirty = false;
let onNodeSelected = defaultNode => {
// Cancel this promise resolution as a new one had
// been queued up.
@@ -895,16 +898,28 @@ Inspector.prototype = {
// Wait for full expand of the selected node in order to ensure
// the markup view is fully emitted before firing 'reloaded'.
// 'reloaded' is used to know when the panel is fully updated
// after a page reload.
yield onExpand;
this.emit("reloaded");
+
+ // Record the time between new-root event and inspector fully loaded.
+ if (this._newRootStart) {
+ // Only log the timing when inspector is not destroyed and is in foreground.
+ if (this.toolbox && this.toolbox.currentToolId == "inspector") {
+ let delay = this.panelWin.performance.now() - this._newRootStart;
+ let telemetryKey = "DEVTOOLS_INSPECTOR_NEW_ROOT_TO_RELOAD_DELAY_MS";
+ let histogram = Services.telemetry.getHistogramById(telemetryKey);
+ histogram.add(delay);
+ }
+ delete this._newRootStart;
+ }
}),
_selectionCssSelector: null,
/**
* Set the currently selected node unique css selector.
* Will store the current target url along with it to allow pre-selection at
* reload
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8441,16 +8441,26 @@
"bug_numbers": [1405585],
"expires_in_version": "62",
"kind": "exponential",
"high": 120000,
"n_buckets": 100,
"keyed": true,
"description": "Time taken (in ms) to update DevTools panel when reloading a page. This is keyed by tool ID being currently opened [inspector, webconsole, jsdebugger, styleeditor, shadereditor, canvasdebugger, performance, memory, netmonitor, storage, webaudioeditor, scratchpad, dom]."
},
+ "DEVTOOLS_INSPECTOR_NEW_ROOT_TO_RELOAD_DELAY_MS": {
+ "record_in_processes": ["main"],
+ "alert_emails": ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"],
+ "bug_numbers": [1405585],
+ "expires_in_version": "62",
+ "kind": "exponential",
+ "high": 120000,
+ "n_buckets": 100,
+ "description": "Time taken (in ms) to update the inspector during a page reload, starting from new-root event."
+ },
"DEVTOOLS_DEBUGGER_DISPLAY_SOURCE_LOCAL_MS": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 10000,
"n_buckets": 1000,
"description": "The time (in milliseconds) that it took to display a selected source to the user."
},