Commit 4ce6000e authored by Emma Zuehlcke's avatar Emma Zuehlcke Committed by ezuehlcke@mozilla.com
Browse files

Bug 1966727 - Record BTP Nimbus exposure in MODE_ENABLED_DRY_RUN too....

Bug 1966727 - Record BTP Nimbus exposure in MODE_ENABLED_DRY_RUN too. r=anti-tracking-reviewers,timhuang

Differential Revision: https://phabricator.services.mozilla.com/D249636
parent 2644b44e
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -1002,6 +1002,20 @@ BounceTrackingProtection::PurgeBounceTrackers() {
                    }
                  }

                  // Record exposure of the feature for Nimbus
                  // experimentation.
                  // The error result returned by this method isn't very
                  // useful, so we ignore it. Thee method will also return
                  // errors if the client is not enrolled in an experiment
                  // involving BTP which we don't consider a failure state.
                  //
                  // We record exposure for MODE_ENABLED_DRY_RUN in addition to
                  // MODE_ENABLED so we know in Nimbus when a client would have
                  // been exposed to BTP had it been enabled. This enables us to
                  // compare the control and treatment branches with exposure.
                  Unused << NimbusFeatures::RecordExposureEvent(
                      "bounceTrackingProtection"_ns, false);

                  if (StaticPrefs::privacy_bounceTrackingProtection_mode() ==
                      nsIBounceTrackingProtection::MODE_ENABLED) {
                    // Log successful purges.
@@ -1021,15 +1035,6 @@ BounceTrackingProtection::PurgeBounceTrackers() {
                      // Record successful purges via nsITrackingDBService for
                      // tracker stats.
                      ReportPurgedTrackersToAntiTrackingDB(purgedSites);

                      // Record exposure of the feature for Nimbus
                      // experimentation.
                      // The error result returned by this method isn't very
                      // useful, so we ignore it. Thee method will also return
                      // errors if the client is not enrolled in an experiment
                      // involving BTP which we don't consider a failure state.
                      Unused << NimbusFeatures::RecordExposureEvent(
                          "bounceTrackingProtection"_ns, false);
                    }
                  }

+9 −4
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ add_task(async function test_nimbus_exposure() {
  Services.fog.testResetFOG();
});

add_task(async function test_nimbus_no_exposure_dry_run() {
add_task(async function test_nimbus_exposure_dry_run() {
  Services.fog.testResetFOG();

  Assert.equal(
@@ -134,9 +134,14 @@ add_task(async function test_nimbus_no_exposure_dry_run() {

  exposureEvents = Glean.normandy.exposeNimbusExperiment.testGetValue();
  Assert.equal(
    undefined,
    exposureEvents,
    "No Glean exposure events after BTP dry-run purge."
    1,
    exposureEvents?.length,
    "There should be one exposure event after BTP purged."
  );
  Assert.equal(
    "bounceTrackingProtection",
    exposureEvents[0].extra.featureId,
    "Feature ID matches BTP."
  );

  await doExperimentCleanup();