Skip to content

Commit 2ac0a7e

Browse files
committed
Bug 1855604 - Back out putting provenance attribution in installation.first_seen r=nalexander
Backs out Bug 1821189's patch: https://hg.mozilla.org/mozilla-central/rev/c4f8098f81bb Differential Revision: https://phabricator.services.mozilla.com/D189591
1 parent 37f1a9e commit 2ac0a7e

File tree

5 files changed

+14
-164
lines changed

5 files changed

+14
-164
lines changed

browser/components/attribution/ProvenanceData.sys.mjs

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -441,47 +441,28 @@ export var ProvenanceData = {
441441
/**
442442
* Only submits telemetry once, no matter how many times it is called.
443443
* Has no effect on OSs where provenance data is not supported.
444-
*
445-
* @returns An object indicating the values submitted. Keys may not match the
446-
* Scalar names since the returned object is intended to be suitable
447-
* for use as a Telemetry Event's `extra` object, which has shorter
448-
* limits for extra key names than the limits for Scalar names.
449-
* Values will be converted to strings since Telemetry Event's
450-
* `extra` objects must have string values.
451-
* On platforms that do not support provenance data, this will always
452-
* return an empty object.
453444
*/
454445
async submitProvenanceTelemetry() {
455446
if (gTelemetryPromise) {
456447
return gTelemetryPromise;
457448
}
458449
gTelemetryPromise = (async () => {
459450
const errorValue = "error";
460-
461-
let extra = {};
462-
463451
let provenance = await this.readZoneIdProvenanceFile();
464452
if (!provenance) {
465-
return extra;
453+
return;
466454
}
467455

468-
let setTelemetry = (scalarName, extraKey, value) => {
469-
Services.telemetry.scalarSet(scalarName, value);
470-
extra[extraKey] = value.toString();
471-
};
472-
473-
setTelemetry(
456+
Services.telemetry.scalarSet(
474457
"attribution.provenance.data_exists",
475-
"data_exists",
476458
!provenance.readProvenanceError
477459
);
478460
if (provenance.readProvenanceError) {
479-
return extra;
461+
return;
480462
}
481463

482-
setTelemetry(
464+
Services.telemetry.scalarSet(
483465
"attribution.provenance.file_system",
484-
"file_system",
485466
provenance.fileSystem ?? errorValue
486467
);
487468

@@ -494,50 +475,42 @@ export var ProvenanceData = {
494475
provenance.readZoneIdError == "openFile" &&
495476
provenance.readZoneIdErrorCode == ERROR_FILE_NOT_FOUND
496477
);
497-
setTelemetry(
478+
Services.telemetry.scalarSet(
498479
"attribution.provenance.ads_exists",
499-
"ads_exists",
500480
ads_exists
501481
);
502482
if (!ads_exists) {
503-
return extra;
483+
return;
504484
}
505485

506-
setTelemetry(
486+
Services.telemetry.scalarSet(
507487
"attribution.provenance.security_zone",
508-
"security_zone",
509488
"zoneId" in provenance ? provenance.zoneId.toString() : errorValue
510489
);
511490

512491
let haveReferrerUrl = URL.isInstance(provenance.referrerUrl);
513-
setTelemetry(
492+
Services.telemetry.scalarSet(
514493
"attribution.provenance.referrer_url_exists",
515-
"refer_url_exist",
516494
haveReferrerUrl
517495
);
518496
if (haveReferrerUrl) {
519-
setTelemetry(
497+
Services.telemetry.scalarSet(
520498
"attribution.provenance.referrer_url_is_mozilla",
521-
"refer_url_moz",
522499
provenance.referrerUrlIsMozilla
523500
);
524501
}
525502

526503
let haveHostUrl = URL.isInstance(provenance.hostUrl);
527-
setTelemetry(
504+
Services.telemetry.scalarSet(
528505
"attribution.provenance.host_url_exists",
529-
"host_url_exist",
530506
haveHostUrl
531507
);
532508
if (haveHostUrl) {
533-
setTelemetry(
509+
Services.telemetry.scalarSet(
534510
"attribution.provenance.host_url_is_mozilla",
535-
"host_url_moz",
536511
provenance.hostUrlIsMozilla
537512
);
538513
}
539-
540-
return extra;
541514
})();
542515
return gTelemetryPromise;
543516
},

browser/components/attribution/test/xpcshell/test_zoneId_parsing.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@ add_setup(function setup() {
2727
// If `iniFileContents` is passed as `null`, we will simulate an error reading
2828
// the INI.
2929
async function testProvenance(iniFileContents, testFn, telemetryTestFn) {
30-
// The extra data returned by `ProvenanceData.submitProvenanceTelemetry` uses
31-
// names that don't actually match the scalar names due to name length
32-
// restrictions.
33-
let scalarToExtraKeyMap = {
34-
"attribution.provenance.data_exists": "data_exists",
35-
"attribution.provenance.file_system": "file_system",
36-
"attribution.provenance.ads_exists": "ads_exists",
37-
"attribution.provenance.security_zone": "security_zone",
38-
"attribution.provenance.referrer_url_exists": "refer_url_exist",
39-
"attribution.provenance.referrer_url_is_mozilla": "refer_url_moz",
40-
"attribution.provenance.host_url_exists": "host_url_exist",
41-
"attribution.provenance.host_url_is_mozilla": "host_url_moz",
42-
};
43-
4430
if (iniFileContents == null) {
4531
AttributionIOUtils.readUTF8 = async path => {
4632
throw new Error("test error: simulating provenance file read error");
@@ -54,15 +40,13 @@ async function testProvenance(iniFileContents, testFn, telemetryTestFn) {
5440
}
5541
if (telemetryTestFn) {
5642
Services.telemetry.clearScalars();
57-
let extras = await ProvenanceData.submitProvenanceTelemetry();
43+
await ProvenanceData.submitProvenanceTelemetry();
5844
let scalars = Services.telemetry.getSnapshotForScalars(
5945
"new-profile",
6046
false /* aClear */
6147
).parent;
6248
let checkScalar = (scalarName, expectedValue) => {
6349
TelemetryTestUtils.assertScalar(scalars, scalarName, expectedValue);
64-
let extraKey = scalarToExtraKeyMap[scalarName];
65-
Assert.equal(extras[extraKey], expectedValue.toString());
6650
};
6751
telemetryTestFn(checkScalar);
6852
}

browser/modules/BrowserUsageTelemetry.sys.mjs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,9 +1283,8 @@ export let BrowserUsageTelemetry = {
12831283
return;
12841284
}
12851285

1286-
let provenanceExtra = {};
12871286
try {
1288-
provenanceExtra = await lazy.ProvenanceData.submitProvenanceTelemetry();
1287+
await lazy.ProvenanceData.submitProvenanceTelemetry();
12891288
} catch (ex) {
12901289
console.warn(
12911290
"reportInstallationTelemetry - submitProvenanceTelemetry failed",
@@ -1422,13 +1421,6 @@ export let BrowserUsageTelemetry = {
14221421
null,
14231422
extra
14241423
);
1425-
Services.telemetry.recordEvent(
1426-
"installation",
1427-
"first_seen_prov_ext",
1428-
installer_type,
1429-
null,
1430-
provenanceExtra
1431-
);
14321424
},
14331425
};
14341426

browser/modules/test/unit/test_InstallationTelemetry.js

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
const { AppConstants } = ChromeUtils.importESModule(
77
"resource://gre/modules/AppConstants.sys.mjs"
88
);
9-
const { AttributionIOUtils } = ChromeUtils.importESModule(
10-
"resource:///modules/AttributionCode.sys.mjs"
11-
);
129
const { BrowserUsageTelemetry } = ChromeUtils.importESModule(
1310
"resource:///modules/BrowserUsageTelemetry.sys.mjs"
1411
);
@@ -72,62 +69,15 @@ async function runReport(
7269
expectExtra
7370
? [{ object: installType, value: null, extra: expectExtra }]
7471
: [],
75-
{ category: "installation", method: "first_seen" },
76-
{ clear: false }
72+
{ category: "installation", method: "first_seen" }
7773
);
78-
// Provenance Data is currently only supported on Windows.
79-
if (AppConstants.platform == "win") {
80-
let provenanceExtra = {
81-
data_exists: "true",
82-
file_system: "NTFS",
83-
ads_exists: "true",
84-
security_zone: "3",
85-
refer_url_exist: "true",
86-
refer_url_moz: "true",
87-
host_url_exist: "true",
88-
host_url_moz: "true",
89-
};
90-
TelemetryTestUtils.assertEvents(
91-
expectExtra
92-
? [{ object: installType, value: null, extra: provenanceExtra }]
93-
: [],
94-
{ category: "installation", method: "first_seen_prov_ext" }
95-
);
96-
} else {
97-
TelemetryTestUtils.assertEvents(
98-
expectExtra ? [{ object: installType, value: null, extra: {} }] : [],
99-
{ category: "installation", method: "first_seen_prov_ext" }
100-
);
101-
}
10274

10375
// Check timestamp
10476
if (typeof expectTS == "string") {
10577
Assert.equal(expectTS, Services.prefs.getStringPref(TIMESTAMP_PREF));
10678
}
10779
}
10880

109-
add_setup(function setup() {
110-
let origReadUTF8 = AttributionIOUtils.readUTF8;
111-
registerCleanupFunction(() => {
112-
AttributionIOUtils.readUTF8 = origReadUTF8;
113-
});
114-
AttributionIOUtils.readUTF8 = async path => {
115-
return `
116-
[Mozilla]
117-
fileSystem=NTFS
118-
zoneIdFileSize=194
119-
zoneIdBufferLargeEnough=true
120-
zoneIdTruncated=false
121-
122-
[MozillaZoneIdentifierStartSentinel]
123-
[ZoneTransfer]
124-
ZoneId=3
125-
ReferrerUrl=https://mozilla.org/
126-
HostUrl=https://download-installer.cdn.mozilla.net/pub/firefox/nightly/latest-mozilla-central-l10n/Firefox%20Installer.en-US.exe
127-
`;
128-
};
129-
});
130-
13181
let condition = {
13282
skip_if: () =>
13383
AppConstants.platform !== "win" ||

toolkit/components/telemetry/Events.yaml

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,55 +3516,6 @@ installation:
35163516
- application-update-telemetry-alerts@mozilla.com
35173517
- rtestard@mozilla.com
35183518
expiry_version: never
3519-
first_seen_prov_ext:
3520-
description: >
3521-
This is an extension of the `installation.first_seen` event. It will always be recorded at
3522-
the same time as that event, so an event ping that contains one will generally contain the
3523-
other (the exception being if the event ping splits between the two and one of the two pings
3524-
fails to be received properly, which should be exceedingly rare). The reason for this event
3525-
to exist is that we want to include more than 10 `extra_keys`, but the limit is 10. The
3526-
specific extra keys that we want to include are related to provenance data (see Bug 1814968).
3527-
objects:
3528-
- full # if the full installer was run directly
3529-
- stub # if the stub installer was used
3530-
- msix # if the installation was done through an MSIX package
3531-
release_channel_collection: opt-out
3532-
record_in_processes: ["main"]
3533-
products: ["firefox"]
3534-
operating_systems: ["windows"]
3535-
extra_keys:
3536-
data_exists: >
3537-
Will be "true" if the "zoneIdProvenanceData" file is present in the installation directory
3538-
and we were able to successfully read it. This key is only present on platforms that
3539-
support provenance data.
3540-
file_system: >
3541-
The file system that the installer resided on at installation time. Possible values are:
3542-
"NTFS", "FAT32", "other". In error cases, it can also be "missing", "error" or
3543-
"readIniError". This key is only present if `data_exists` is "true".
3544-
ads_exists: >
3545-
Will always be false if `data_exists` is false. Will be "true" if the provenance data
3546-
indicates that the :Zone.Identifier Alternate Data Stream existed on the installer.
3547-
security_zone: >
3548-
The zone identifier in the installer's :Zone.Identifier ADS. Possible values are integers
3549-
between 0 and 4, inclusive (encoded as strings). In error cases, it can also be
3550-
"unexpected", "missing", "error", or "readIniError". This key is only present if
3551-
`ads_exists` is "true".
3552-
refer_url_exist: >
3553-
Will be "true" if the zone identifier ADS contained a referrer URL. Will be false if a
3554-
referrer URL is specified, but it isn't a valid URL. Only sent if `ads_exists` is "true".
3555-
refer_url_moz: >
3556-
Will be "true" if the referrer URL from the zone identifier ADS appeared to be a Mozilla
3557-
URL. Only sent if `refer_url_exist` is "true".
3558-
host_url_exist: >
3559-
Will be "true" if the zone identifier ADS contained a host URL. Will be false if a host URL
3560-
is specified, but it isn't a valid URL. Only sent if `ads_exists` is "true".
3561-
host_url_moz: >
3562-
Will be "true" if the host URL from the zone identifier ADS appeared to be a Mozilla URL.
3563-
Only sent if `host_url_exists` is "true".
3564-
bug_numbers: [1814968, 1821189]
3565-
notification_emails:
3566-
- application-update-telemetry-alerts@mozilla.com
3567-
expiry_version: "121"
35683519

35693520
contextservices.quicksuggest:
35703521
data_collect_toggled:

0 commit comments

Comments
 (0)