Bug 1121001 - Record a uitour ping when a tag is set, r=gfritzsche

--HG--
extra : rebase_source : 71e846e33d9e9bc4acf9c8ba1173bfaa00ca2d6b
This commit is contained in:
Benjamin Smedberg 2015-04-27 15:00:20 -04:00
parent 08ceb34ed5
commit 45bc946f03
4 changed files with 51 additions and 3 deletions

View File

@ -12,6 +12,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/TelemetryController.jsm");
Cu.importGlobalProperties(["URL"]);
@ -1978,6 +1979,16 @@ const DAILY_DISCRETE_TEXT_FIELD = Metrics.Storage.FIELD_DAILY_DISCRETE_TEXT;
*/
const UITourHealthReport = {
recordTreatmentTag: function(tag, value) {
TelemetryController.submitExternalPing("uitour-tag",
{
version: 1,
tagName: tag,
tagValue: value,
},
{
addClientId: true,
addEnvironment: true,
});
#ifdef MOZ_SERVICES_HEALTHREPORT
Task.spawn(function*() {
let reporter = Cc["@mozilla.org/datareporting/service;1"]

View File

@ -8,6 +8,7 @@ let gContentAPI;
let gContentWindow;
Components.utils.import("resource:///modules/UITour.jsm");
Components.utils.import("resource://testing-common/TelemetryArchiveTesting.jsm", this);
function test() {
UITourTest();
@ -400,13 +401,24 @@ let tests = [
});
});
},
function test_treatment_tag(done) {
taskify(function* test_treatment_tag(done) {
let ac = new TelemetryArchiveTesting.Checker();
yield ac.promiseInit();
gContentAPI.setTreatmentTag("foobar", "baz");
gContentAPI.getTreatmentTag("foobar", (data) => {
is(data.value, "baz", "set and retrieved treatmentTag");
done();
ac.promiseFindPing("uitour-tag", [
[["payload", "tagName"], "foobar"],
[["payload", "tagValue"], "baz"],
]).then((found) => {
ok(found, "Telemetry ping submitted for setTreatmentTag");
done();
}, (err) => {
ok(false, "Exeption finding uitour telemetry ping: " + err);
done();
});
});
},
}),
// Make sure this test is last in the file so the appMenu gets left open and done will confirm it got tore down.
taskify(function* cleanupMenus() {

View File

@ -31,6 +31,7 @@ Ping types
* :doc:`main <main-ping>` - contains the information collected by Telemetry (Histograms, hang stacks, ...)
* :doc:`saved-session <main-ping>` - has the same format as a main ping, but it contains the *"classic"* Telemetry payload with measurements covering the whole browser session. This is only a separate type to make storage of saved-session easier server-side. This is temporary and will be removed soon.
* :doc:`crash <crash-ping>` - a ping that is captured and sent after Firefox crashes.
* :doc:`uitour-ping` - a ping submitted via the UITour API
* ``activation`` - *planned* - sent right after installation or profile creation
* ``upgrade`` - *planned* - sent right after an upgrade
* ``deletion`` - *planned* - on opt-out we may have to tell the server to delete user data

View File

@ -0,0 +1,24 @@
"uitour-tag" ping
=================
This ping is submitted via the UITour setTreatmentTag API. It may be used by
the tour to record what settings were made by a user or to track the result of
A/B experiments.
The client ID is submitted with this ping.
Structure::
{
version: 1,
type: "uitour-tag",
clientId: <string>,
payload: {
tagName: <string>,
tagValue: <string>
}
}
See also: :doc:`common ping fields <common-ping>`