Bug 1663857 - Ensure pioneer pings are properly routed to the study tables. r=rhelmer,amiyaguchi

Depends on D89718

Differential Revision: https://phabricator.services.mozilla.com/D89798
This commit is contained in:
Alessio Placitelli 2020-09-10 17:25:24 +00:00
parent 780c1910c2
commit 447da79e49
3 changed files with 9 additions and 7 deletions

View File

@ -730,7 +730,9 @@ async function sendDeletionPing(studyAddonId) {
},
schemaName: "deletion-request",
schemaVersion: 1,
schemaNamespace: "pioneer-debug",
// The schema namespace needs to be the study addon id, as we
// want to route the ping to the specific study table.
schemaNamespace: studyAddonId,
};
const payload = {
@ -777,9 +779,9 @@ async function sendEnrollmentPing(studyAddonId) {
// the work on the ingestion pipeline.
if (typeof studyAddonId != "undefined") {
options.studyName = studyAddonId;
// This is the same namespace used for 'deletion-request' pings. This works because
// the pipeline has a specific exception for it.
options.schemaNamespace = "pioneer-debug";
// The schema namespace needs to be the study addon id, as we
// want to route the ping to the specific study table.
options.schemaNamespace = studyAddonId;
}
await TelemetryController.submitExternalPing("pioneer-study", {}, options);

View File

@ -875,7 +875,7 @@ add_task(async function testEnrollmentPings() {
pingDetails.find(
p =>
p.schemaName == "pioneer-enrollment" &&
p.schemaNamespace == "pioneer-debug" &&
p.schemaNamespace == CACHED_TEST_ADDON.addon_id &&
p.pioneerId == pioneerId &&
p.studyName == CACHED_TEST_ADDON.addon_id
),

View File

@ -18,7 +18,7 @@ Structure:
"encryptedData": "<encrypted token>",
"schemaVersion": 1,
"schemaName": "debug",
"schemaNamespace": "pioneer-debug",
"schemaNamespace": "<namespace>",
"encryptionKeyId": "debug",
"pioneerId": "<UUID>",
"studyName": "pioneer-v2-example"
@ -55,4 +55,4 @@ This ping has two special Pioneer payload configurations, indicated by the diffe
The `deletion-request` is sent when a user opts out from a Pioneer study: it contains the `pioneerId` and the `studyName`.
The `pioneer-enrollment` is sent when a user opts into the Pioneer program: in this case it reports `schemaNamespace: "pioneer-meta"` and will have no `studyName`. It is also sent when enrolling into a study, in which case it reports the same namespace as the `deletion-request` (i.e. `"pioneer-debug"`) and the `pioneer-enrollment` schema name.
The `pioneer-enrollment` is sent when a user opts into the Pioneer program: in this case it reports `schemaNamespace: "pioneer-meta"` and will have no `studyName`. It is also sent when enrolling into a study, in which case it reports the same namespace as the `deletion-request` (i.e. the id the study making the request) and the `pioneer-enrollment` schema name.