Closed
Bug 1329978
Opened 8 years ago
Closed 8 years ago
Add pref to override TelemetrySend official check in sendingEnabled
Categories
(Toolkit :: Telemetry, defect, P1)
Toolkit
Telemetry
Tracking
()
RESOLVED
FIXED
mozilla54
People
(Reporter: gfritzsche, Assigned: Dexter, Mentored)
Details
(Whiteboard: [measurement:client])
Attachments
(1 file, 5 obsolete files)
7.57 KB,
patch
|
Dexter
:
review+
|
Details | Diff | Splinter Review |
Automation tests need to override the send restriction that we have:
https://dxr.mozilla.org/mozilla-central/rev/845cc4dea57f6cc93f46810d24b1058b640c3b74/toolkit/components/telemetry/TelemetrySend.jsm#1038
Reporter | ||
Comment 1•8 years ago
|
||
I would suggest we use a hidden boolean pref "toolkit.telemetry.send.overrideOfficialCheck".
This will need to add a check against the pref here:
https://dxr.mozilla.org/mozilla-central/rev/845cc4dea57f6cc93f46810d24b1058b640c3b74/toolkit/components/telemetry/TelemetrySend.jsm#1040
... of the form `Preferences.get(prefName, false)`.
We need to add documentation for the preference here:
https://dxr.mozilla.org/mozilla-central/rev/845cc4dea57f6cc93f46810d24b1058b640c3b74/toolkit/components/telemetry/docs/internals/preferences.rst#92
Reporter | ||
Updated•8 years ago
|
Assignee: nobody → jdorlus
Mentor: gfritzsche, alessio.placitelli
Reporter | ||
Updated•8 years ago
|
Points: --- → 1
Comment 2•8 years ago
|
||
This patch is a compilation of the new telemetry server stuff and an attempt to create a new pref. I am getting false positives so I know that I did something wrong.
Attachment #8827981 -
Flags: feedback?(alessio.placitelli)
Assignee | ||
Comment 3•8 years ago
|
||
Comment on attachment 8827981 [details] [diff] [review]
new_pref.patch
Review of attachment 8827981 [details] [diff] [review]:
-----------------------------------------------------------------
I think you're seeing issues because of the location you added the pref check (which is commented in the current patch).
::: toolkit/components/telemetry/TelemetrySend.jsm
@@ +1041,5 @@
> * @return {Boolean} True if pings can be send to the servers, false otherwise.
> */
> sendingEnabled(ping = null) {
> // We only send pings from official builds, but allow overriding this for tests.
> if (!Telemetry.isOfficialTelemetry && !this._testMode) {
The pref check should be here, not below. If you add it below this point, it won't get checked on unofficial builds, making the pref useless.
Just add it as "&& !IS_OVERRIDE_OFFICIAL_CHECK" after the _testMod check, on a new line.
@@ +1057,5 @@
> return Preferences.get(PREF_FHR_UPLOAD_ENABLED, false);
> }
>
> + //If the override is enabled, send pings regardless.
> + // if (PREF_SEND_OVERRIDE_OFFICIAL_CHECK) {
You were checking the pref name here, not the pref value which is in IS_OVERRIDE_OFFICIAL_CHECK.
Attachment #8827981 -
Flags: feedback?(alessio.placitelli)
Comment 4•8 years ago
|
||
Revision per notes above
Attachment #8827981 -
Attachment is obsolete: true
Attachment #8828019 -
Flags: feedback?(alessio.placitelli)
Assignee | ||
Comment 5•8 years ago
|
||
Comment on attachment 8828019 [details] [diff] [review]
new_pref_revised.patch
this patch looks corrupted, as it contains more than 1 header and different changesets for the same file.
Please attach a working patch.
Attachment #8828019 -
Flags: feedback?(alessio.placitelli)
Comment 6•8 years ago
|
||
Redid the patch. I think it had multiple revisions in the previous file because of the fact I exported commits to make a patch file. Some commits touched the same file. I think I made it work this time around though.
Attachment #8828019 -
Attachment is obsolete: true
Attachment #8828110 -
Flags: feedback?(alessio.placitelli)
Assignee | ||
Comment 7•8 years ago
|
||
Comment on attachment 8828110 [details] [diff] [review]
new_pref_git_revised.patch
John, this still has 4 "# HG changeset patch" sections and reports changes to TelemetrySend.jsm twice.
Attachment #8828110 -
Flags: feedback?(alessio.placitelli)
Assignee | ||
Comment 8•8 years ago
|
||
I had a look at the raw file and, assuming the last export is the one with your latest changes, I see a problem:
> else if (IS_OVERRIDE_OFFICIAL_CHECK)
> return true;
You added this part to TelemetrySend.jsm: it's not needed and will result in unexpected behaviour, as it will basically ignore all the other telemetry prefs when enabled. Please remove it.
Moreover, it looks like TelemetrySend.jsm doesn't contain the preferences anymore (where is IS_OVERRIDE_OFFICIAL_CHECK defined?). I don't know if that's happening because of the way you're exporting the patches.
Comment 9•8 years ago
|
||
Assigning to Alessio to continue the work on this.
Assignee: jdorlus → alessio.placitelli
Assignee | ||
Comment 10•8 years ago
|
||
This patch adds a new hidden preference (and the related test coverage) to override the isOfficialTelemetry check.
Attachment #8828110 -
Attachment is obsolete: true
Attachment #8830298 -
Flags: review?(gfritzsche)
Reporter | ||
Comment 11•8 years ago
|
||
Comment on attachment 8830298 [details] [diff] [review]
bug1329978.patch
Review of attachment 8830298 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/telemetry/TelemetrySend.jsm
@@ +45,5 @@
> const PREF_BRANCH = "toolkit.telemetry.";
> const PREF_SERVER = PREF_BRANCH + "server";
> const PREF_UNIFIED = PREF_BRANCH + "unified";
> const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
> +const PREF_SEND_OVERRIDE_OFFICIAL_CHECK = PREF_BRANCH + "send.overrideOfficialCheck";
Nit: I think the `SEND` part is redundant here in this module.
Please also document the pref in preferences.rst, including that restart is required.
@@ +55,5 @@
> // Changing this pref requires a restart.
> const IS_UNIFIED_TELEMETRY = Preferences.get(PREF_UNIFIED, false);
>
> +// Whether sending pings has been overridden.
> +const SEND_OVERRIDE_OFFICIAL_CHECK = Preferences.get(PREF_SEND_OVERRIDE_OFFICIAL_CHECK, false);
Ditto.
::: toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ +449,5 @@
> + PingServer.resetPingHandler();
> + yield TelemetryController.submitExternalPing(TEST_PING_TYPE, { test: "test" });
> +
> + // Make sure we received the ping.
> + yield PingServer.promiseNextPings(1);
`promiseNextPing()`.
Also check at least the ping type.
@@ +453,5 @@
> + yield PingServer.promiseNextPings(1);
> +
> + // Restore the test mode and disable the override.
> + TelemetrySend.setTestModeEnabled(true);
> + Preferences.set(PREF_SEND_OVERRIDE, false);
Nit: I think you'd want to reset the pref to default, not set it to an explicit value `false`.
@@ +457,5 @@
> + Preferences.set(PREF_SEND_OVERRIDE, false);
> +});
> +
> +add_task(function* cleanup() {
> + PingServer.stop();
yield ...
Attachment #8830298 -
Flags: review?(gfritzsche) → review+
Assignee | ||
Comment 12•8 years ago
|
||
Thanks Georg. This addresses your comments and moves the pref inside TelemetrySendImpl to ease testing.
Attachment #8830298 -
Attachment is obsolete: true
Attachment #8830709 -
Flags: review+
Assignee | ||
Comment 13•8 years ago
|
||
Assignee | ||
Comment 14•8 years ago
|
||
The new test was failing on official/release builds on automation since isOfficialTelemetry is always true there. I've changed the test to not check for discarding the pings on official builds.
Carrying over the r+.
Attachment #8830709 -
Attachment is obsolete: true
Attachment #8831047 -
Flags: review+
Assignee | ||
Comment 15•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Status: NEW → ASSIGNED
Keywords: checkin-needed
Comment 16•8 years ago
|
||
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4e8cdfa12989
Add pref to override TelemetrySend official check in sendingEnabled. r=gfritzsche
Keywords: checkin-needed
Comment 17•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•