зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064333 - Add the stable client id to the telemetry ping. r=froydnj
This commit is contained in:
Родитель
8594bb83b2
Коммит
7c59ca03eb
|
@ -247,6 +247,7 @@ let Impl = {
|
|||
// The previous build ID, if this is the first run with a new build.
|
||||
// Undefined if this is not the first run, or the previous build ID is unknown.
|
||||
_previousBuildID: undefined,
|
||||
_clientID: null,
|
||||
|
||||
/**
|
||||
* Gets a series of simple measurements (counters). At the moment, this
|
||||
|
@ -701,7 +702,8 @@ let Impl = {
|
|||
addonDetails: AddonManagerPrivate.getTelemetryDetails(),
|
||||
UIMeasurements: UITelemetry.getUIMeasurements(),
|
||||
log: TelemetryLog.entries(),
|
||||
info: info
|
||||
info: info,
|
||||
clientID: this._clientID,
|
||||
};
|
||||
|
||||
if (Object.keys(this._slowSQLStartup).length != 0 &&
|
||||
|
@ -957,6 +959,11 @@ let Impl = {
|
|||
this.attachObservers();
|
||||
this.gatherMemory();
|
||||
|
||||
let drs = Cc["@mozilla.org/datareporting/service;1"]
|
||||
.getService(Ci.nsISupports)
|
||||
.wrappedJSObject;
|
||||
this._clientID = yield drs.getClientID();
|
||||
|
||||
Telemetry.asyncFetchTelemetryData(function () {});
|
||||
delete this._timer;
|
||||
deferred.resolve();
|
||||
|
|
|
@ -41,11 +41,20 @@ const RW_OWNER = 0600;
|
|||
const NUMBER_OF_THREADS_TO_LAUNCH = 30;
|
||||
let gNumberOfThreadsLaunched = 0;
|
||||
|
||||
const PREF_BRANCH = "toolkit.telemetry.";
|
||||
const PREF_ENABLED = PREF_BRANCH + "enabled";
|
||||
|
||||
const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
|
||||
|
||||
let gHttpServer = new HttpServer();
|
||||
let gServerStarted = false;
|
||||
let gRequestIterator = null;
|
||||
let gDataReportingClientID = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
|
||||
() => Cc["@mozilla.org/datareporting/service;1"]
|
||||
.getService(Ci.nsISupports)
|
||||
.wrappedJSObject);
|
||||
|
||||
function sendPing () {
|
||||
TelemetryPing.gatherStartup();
|
||||
|
@ -162,6 +171,10 @@ function checkPayloadInfo(payload, reason) {
|
|||
do_check_true(payload.info.revision.startsWith("http"));
|
||||
}
|
||||
|
||||
do_check_true("clientID" in payload);
|
||||
do_check_neq(payload.clientID, null);
|
||||
do_check_eq(payload.clientID, gDataReportingClientID);
|
||||
|
||||
try {
|
||||
// If we've not got nsIGfxInfoDebug, then this will throw and stop us doing
|
||||
// this test.
|
||||
|
@ -379,6 +392,13 @@ function run_test() {
|
|||
do_get_profile();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_ENABLED, true);
|
||||
|
||||
// Send the needed startup notifications to the datareporting service
|
||||
// to ensure that it has been initialized.
|
||||
gDatareportingService.observe(null, "app-startup", null);
|
||||
gDatareportingService.observe(null, "profile-after-change", null);
|
||||
|
||||
// Make it look like we've previously failed to lock a profile a couple times.
|
||||
write_fake_failedprofilelocks_file();
|
||||
|
||||
|
@ -425,6 +445,12 @@ function actualTest() {
|
|||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* asyncSetup() {
|
||||
yield TelemetryPing.setup();
|
||||
|
||||
gDataReportingClientID = yield gDatareportingService.getClientID();
|
||||
});
|
||||
|
||||
// Ensure that not overwriting an existing file fails silently
|
||||
add_task(function* test_overwritePing() {
|
||||
let ping = {slug: "foo"}
|
||||
|
|
|
@ -15,10 +15,16 @@
|
|||
|
||||
"use strict"
|
||||
|
||||
const Cu = Components.utils;
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
|
||||
() => Cc["@mozilla.org/datareporting/service;1"]
|
||||
.getService(Ci.nsISupports)
|
||||
.wrappedJSObject);
|
||||
|
||||
// Force the Telemetry enabled preference so that TelemetryPing.reset() doesn't exit early.
|
||||
Services.prefs.setBoolPref(TelemetryPing.Constants.PREF_ENABLED, true);
|
||||
|
@ -65,5 +71,11 @@ add_task(function* test_newBuild() {
|
|||
function run_test() {
|
||||
// Make sure we have a profile directory.
|
||||
do_get_profile();
|
||||
|
||||
// Send the needed startup notifications to the datareporting service
|
||||
// to ensure that it has been initialized.
|
||||
gDatareportingService.observe(null, "app-startup", null);
|
||||
gDatareportingService.observe(null, "profile-after-change", null);
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -23,8 +23,14 @@ Cu.import("resource://gre/modules/Promise.jsm", this);
|
|||
Cu.import("resource://gre/modules/TelemetryFile.jsm", this);
|
||||
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
|
||||
Cu.import("resource://gre/modules/Task.jsm", this);
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
let {OS: {File, Path, Constants}} = Cu.import("resource://gre/modules/osfile.jsm", {});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
|
||||
() => Cc["@mozilla.org/datareporting/service;1"]
|
||||
.getService(Ci.nsISupports)
|
||||
.wrappedJSObject);
|
||||
|
||||
// We increment TelemetryFile's MAX_PING_FILE_AGE and
|
||||
// OVERDUE_PING_FILE_AGE by 1 minute so that our test pings exceed
|
||||
// those points in time, even taking into account file system imprecision.
|
||||
|
@ -190,6 +196,12 @@ function run_test() {
|
|||
gHttpServer.registerPrefixHandler("/submit/telemetry/", pingHandler);
|
||||
gHttpServer.start(-1);
|
||||
do_get_profile();
|
||||
|
||||
// Send the needed startup notifications to the datareporting service
|
||||
// to ensure that it has been initialized.
|
||||
gDatareportingService.observe(null, "app-startup", null);
|
||||
gDatareportingService.observe(null, "profile-after-change", null);
|
||||
|
||||
Services.prefs.setBoolPref(TelemetryPing.Constants.PREF_ENABLED, true);
|
||||
Services.prefs.setCharPref(TelemetryPing.Constants.PREF_SERVER,
|
||||
"http://localhost:" + gHttpServer.identity.primaryPort);
|
||||
|
|
Загрузка…
Ссылка в новой задаче