Bug 1396811 - Add new telemetry probe collecting the current theme; r=chutten,liuche,ochameau

MozReview-Commit-ID: KlUHlc7YEx9

--HG--
extra : rebase_source : 8ae8fc1458a57d60a45869dc2c4796cae63dc7f3
This commit is contained in:
Jan Odvarko 2017-09-11 13:47:56 +02:00
Родитель ec6a9f05ea
Коммит 5b786275f6
3 изменённых файлов: 53 добавлений и 0 удалений

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

@ -12,6 +12,7 @@ const SPLITCONSOLE_HEIGHT_PREF = "devtools.toolbox.splitconsoleHeight";
const DISABLE_AUTOHIDE_PREF = "ui.popup.disable_autohide";
const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
const CURRENT_THEME_SCALAR = "devtools.current_theme";
const HTML_NS = "http://www.w3.org/1999/xhtml";
var {Ci, Cu, Cc} = require("chrome");
@ -650,6 +651,11 @@ Toolbox.prototype = {
this._telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM,
system.getScreenDimensions());
this._telemetry.log(HOST_HISTOGRAM, this._getTelemetryHostId());
// Log current theme. The question we want to answer is:
// "What proportion of users use which themes?"
let currentTheme = Services.prefs.getCharPref("devtools.theme");
this._telemetry.logKeyedScalar(CURRENT_THEME_SCALAR, currentTheme, 1);
},
/**

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

@ -17,6 +17,8 @@ function Telemetry() {
this.toolOpened = this.toolOpened.bind(this);
this.toolClosed = this.toolClosed.bind(this);
this.log = this.log.bind(this);
this.logScalar = this.logScalar.bind(this);
this.logKeyedScalar = this.logKeyedScalar.bind(this);
this.logOncePerBrowserVersion = this.logOncePerBrowserVersion.bind(this);
this.destroy = this.destroy.bind(this);
@ -309,6 +311,36 @@ Telemetry.prototype = {
}
},
/**
* Log a value to a keyed count scalar.
*
* @param {String} scalarId
* Scalar in which the data is to be stored.
* @param {String} key
* The key within the scalar.
* @param value
* Value to store.
*/
logKeyedScalar: function (scalarId, key, value) {
if (!scalarId) {
return;
}
try {
if (isNaN(value)) {
dump(`Warning: An attempt was made to write a non-numeric value ` +
`${value} to the ${scalarId} scalar. Only numeric values are ` +
`allowed.`);
return;
}
Services.telemetry.keyedScalarAdd(scalarId, key, value);
} catch (e) {
dump(`Warning: An attempt was made to write to the ${scalarId} ` +
`scalar, which is not defined in Scalars.yaml\n`);
}
},
/**
* Log a value to a keyed histogram.
*

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

@ -775,6 +775,21 @@ devtools.grid.showInfiniteLines:
record_in_processes:
- 'main'
devtools:
current_theme:
bug_numbers:
- 1396811
description: >
Number of times DevTools was opened, keyed by theme.
expires: never
kind: uint
keyed: true
notification_emails:
- dev-developer-tools@lists.mozilla.org
release_channel_collection: opt-out
record_in_processes:
- 'main'
navigator.storage:
estimate_count:
bug_numbers: