Bug 1465424 - Added 3 histograms to test font editor usage assumptions; r=rcaliman

MozReview-Commit-ID: BIkqEzp5BNA

--HG--
extra : rebase_source : 376ba65ab069bd35b29672a29c8ee723af9bad90
This commit is contained in:
Patrick Brosset 2018-07-19 14:29:40 +02:00
Родитель 8245258aa0
Коммит ca555bea46
2 изменённых файлов: 67 добавлений и 2 удалений

Просмотреть файл

@ -55,6 +55,10 @@ const REGISTERED_AXES_TO_FONT_PROPERTIES = {
};
const REGISTERED_AXES = Object.keys(REGISTERED_AXES_TO_FONT_PROPERTIES);
const HISTOGRAM_N_FONT_AXES = "DEVTOOLS_FONTEDITOR_N_FONT_AXES";
const HISTOGRAM_N_FONTS_RENDERED = "DEVTOOLS_FONTEDITOR_N_FONTS_RENDERED";
const HISTOGRAM_FONT_TYPE_DISPLAYED = "DEVTOOLS_FONTEDITOR_FONT_TYPE_DISPLAYED";
class FontInspector {
constructor(inspector, window) {
this.cssProperties = getCssProperties(inspector.toolbox);
@ -601,6 +605,34 @@ class FontInspector {
!this.inspector.selection.isPseudoElementNode();
}
/**
* Upon a new node selection, log some interesting telemetry probes.
*/
logTelemetryProbesOnNewNode() {
const { fontData, fontEditor } = this.store.getState();
const { telemetry } = this.inspector;
// Log the number of font faces used to render content of the element.
const nbOfFontsRendered = fontData.fonts.length;
if (nbOfFontsRendered) {
telemetry.getHistogramById(HISTOGRAM_N_FONTS_RENDERED).add(nbOfFontsRendered);
}
// Log data about the currently edited font (if any).
// Note that the edited font is always the first one from the fontEditor.fonts array.
const editedFont = fontEditor.fonts[0];
if (!editedFont) {
return;
}
const nbOfAxes = editedFont.variationAxes ? editedFont.variationAxes.length : 0;
telemetry.getHistogramById(HISTOGRAM_FONT_TYPE_DISPLAYED).add(
!nbOfAxes ? "nonvariable" : "variable");
if (nbOfAxes) {
telemetry.getHistogramById(HISTOGRAM_N_FONT_AXES).add(nbOfAxes);
}
}
/**
* Sync the Rule view with the latest styles from the page. Called in a debounced way
* (see constructor) after property changes are applied directly to the CSS style rule
@ -686,8 +718,9 @@ class FontInspector {
onNewNode() {
this.ruleView.off("property-value-updated", this.onRulePropertyUpdated);
if (this.isPanelVisible()) {
this.update();
this.refreshFontEditor();
Promise.all([this.update(), this.refreshFontEditor()]).then(() => {
this.logTelemetryProbesOnNewNode();
}).catch(e => console.error(e));
}
}

Просмотреть файл

@ -10155,6 +10155,38 @@
"description": "On page load, record the number of CSS Grid elements present on a page when the DevTools is open",
"releaseChannelCollection": "opt-out"
},
"DEVTOOLS_FONTEDITOR_N_FONT_AXES": {
"record_in_processes": ["main"],
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "mbalfanz@mozilla.com"],
"expires_in_version": "66",
"bug_numbers": [1465424],
"description": "Indicates the number of variation axes of the variable fonts that are displayed in the font editor UI",
"releaseChannelCollection": "opt-out",
"kind": "exponential",
"high": 100,
"n_buckets": 20
},
"DEVTOOLS_FONTEDITOR_N_FONTS_RENDERED": {
"record_in_processes": ["main"],
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "mbalfanz@mozilla.com"],
"expires_in_version": "66",
"bug_numbers": [1465424],
"description": "Indicates how many fonts the font editor displayed as being needed to render the selected element's content",
"releaseChannelCollection": "opt-out",
"kind": "exponential",
"high": 50,
"n_buckets": 10
},
"DEVTOOLS_FONTEDITOR_FONT_TYPE_DISPLAYED": {
"record_in_processes": ["main"],
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "mbalfanz@mozilla.com"],
"expires_in_version": "66",
"bug_numbers": [1465424],
"description": "Indicates if the font editor displayed its UI for a non-variable font or a variable font",
"releaseChannelCollection": "opt-out",
"kind": "categorical",
"labels": ["variable", "nonvariable"]
},
"BROWSER_IS_USER_DEFAULT": {
"record_in_processes": ["main"],
"expires_in_version": "never",