зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1471647 - Add a pref to override the Telemetry update channel. r=Dexter
MozReview-Commit-ID: 4pRYWT8R8bB --HG-- extra : rebase_source : 4616ea0374139d7424c88a2d557c98645d7b46a1
This commit is contained in:
Родитель
66aaca733d
Коммит
535dd9dbc9
|
@ -55,7 +55,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||
TelemetryStorage: "resource://gre/modules/TelemetryStorage.jsm",
|
||||
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.jsm",
|
||||
UpdateUtils: "resource://gre/modules/UpdateUtils.jsm",
|
||||
TelemetryArchive: "resource://gre/modules/TelemetryArchive.jsm",
|
||||
TelemetrySession: "resource://gre/modules/TelemetrySession.jsm",
|
||||
TelemetrySend: "resource://gre/modules/TelemetrySend.jsm",
|
||||
|
@ -325,7 +324,7 @@ var Impl = {
|
|||
|
||||
let updateChannel = null;
|
||||
try {
|
||||
updateChannel = UpdateUtils.getUpdateChannel(false);
|
||||
updateChannel = Utils.getUpdateChannel();
|
||||
} catch (e) {
|
||||
this._log.trace("_getApplicationSection - Unable to get update channel.", e);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ ChromeUtils.defineModuleGetter(this, "LightweightThemeManager",
|
|||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ProfileAge",
|
||||
"resource://gre/modules/ProfileAge.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "WindowsRegistry",
|
||||
"resource://gre/modules/WindowsRegistry.jsm");
|
||||
|
||||
|
@ -1411,7 +1409,7 @@ EnvironmentCache.prototype = {
|
|||
_updateSettings() {
|
||||
let updateChannel = null;
|
||||
try {
|
||||
updateChannel = UpdateUtils.getUpdateChannel(false);
|
||||
updateChannel = Utils.getUpdateChannel();
|
||||
} catch (e) {}
|
||||
|
||||
this._currentEnvironment.settings = {
|
||||
|
|
|
@ -17,8 +17,6 @@ ChromeUtils.import("resource://gre/modules/TelemetryUtils.jsm", this);
|
|||
|
||||
ChromeUtils.defineModuleGetter(this, "TelemetrySend",
|
||||
"resource://gre/modules/TelemetrySend.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
|
||||
const LOGGER_NAME = "Toolkit.Telemetry";
|
||||
const LOGGER_PREFIX = "TelemetryReportingPolicy::";
|
||||
|
@ -250,7 +248,7 @@ var TelemetryReportingPolicyImpl = {
|
|||
// use the general minimum policy version.
|
||||
let channel = "";
|
||||
try {
|
||||
channel = UpdateUtils.getUpdateChannel(false);
|
||||
channel = TelemetryUtils.getUpdateChannel();
|
||||
} catch (e) {
|
||||
this._log.error("minimumPolicyVersion - Unable to retrieve the current channel.");
|
||||
return minPolicyVersion;
|
||||
|
|
|
@ -11,6 +11,8 @@ var EXPORTED_SYMBOLS = [
|
|||
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
|
||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
|
@ -86,6 +88,7 @@ var TelemetryUtils = {
|
|||
HybridContentEnabled: "toolkit.telemetry.hybridContent.enabled",
|
||||
OverrideOfficialCheck: "toolkit.telemetry.send.overrideOfficialCheck",
|
||||
OverridePreRelease: "toolkit.telemetry.testing.overridePreRelease",
|
||||
OverrideUpdateChannel: "toolkit.telemetry.overrideUpdateChannel",
|
||||
Server: "toolkit.telemetry.server",
|
||||
ShutdownPingSender: "toolkit.telemetry.shutdownPingSender.enabled",
|
||||
ShutdownPingSenderFirstSession: "toolkit.telemetry.shutdownPingSender.enabledFirstSession",
|
||||
|
@ -371,4 +374,21 @@ var TelemetryUtils = {
|
|||
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {string} The name of the update channel to report
|
||||
* in telemetry.
|
||||
* By default, this is the same as the name of the channel that
|
||||
* the browser uses to download its updates. However in certain
|
||||
* situations, a single update channel provides multiple (distinct)
|
||||
* build types, that need to be distinguishable on Telemetry.
|
||||
*/
|
||||
getUpdateChannel() {
|
||||
let overrideChannel = Services.prefs.getCharPref(this.Preferences.OverrideUpdateChannel, undefined);
|
||||
if (overrideChannel) {
|
||||
return overrideChannel;
|
||||
}
|
||||
|
||||
return UpdateUtils.getUpdateChannel(false);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -162,6 +162,11 @@ Preferences
|
|||
The maximum frequency at which an :doc:`../data/event-ping` will be sent.
|
||||
Default is 10 (minutes).
|
||||
|
||||
``toolkit.telemetry.overrideUpdateChannel``
|
||||
|
||||
Override the ``channel`` value that is reported via Telemetry.
|
||||
This is useful for distinguishing different types of builds that otherwise still report as the same update channel.
|
||||
|
||||
Data-choices notification
|
||||
-------------------------
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/ObjectUtils.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/Preferences.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryUtils.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/UpdateUtils.jsm", this);
|
||||
|
||||
add_task(async function testHistogramPacking() {
|
||||
const HISTOGRAM_SNAPSHOT = {
|
||||
|
@ -171,3 +173,21 @@ add_task(async function testKeyedHistogramPacking() {
|
|||
Assert.ok(ObjectUtils.deepEqual(EXPECTED_DATA_TEST, packedKeyedHistogramsTest),
|
||||
"Packed data must be correct.");
|
||||
});
|
||||
|
||||
add_task(async function testUpdateChannelOverride() {
|
||||
if (Preferences.has(TelemetryUtils.Preferences.OverrideUpdateChannel)) {
|
||||
// If the pref is already set at this point, the test is running in a build
|
||||
// that makes use of the override pref. For testing purposes, unset the pref.
|
||||
Preferences.set(TelemetryUtils.Preferences.OverrideUpdateChannel, "");
|
||||
}
|
||||
|
||||
// Check that we return the same channel as UpdateUtils, by default
|
||||
Assert.equal(TelemetryUtils.getUpdateChannel(), UpdateUtils.getUpdateChannel(false),
|
||||
"The telemetry reported channel must match the one from UpdateChannel, by default.");
|
||||
|
||||
// Now set the override pref and check that we return the correct channel
|
||||
const OVERRIDE_TEST_CHANNEL = "nightly-test";
|
||||
Preferences.set(TelemetryUtils.Preferences.OverrideUpdateChannel, OVERRIDE_TEST_CHANNEL);
|
||||
Assert.equal(TelemetryUtils.getUpdateChannel(), OVERRIDE_TEST_CHANNEL,
|
||||
"The telemetry reported channel must match the override pref when pref is set.");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче