Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "day zero" experiment feature & metrics #22195

Merged
merged 2 commits into from
Mar 23, 2024
Merged

Add "day zero" experiment feature & metrics #22195

merged 2 commits into from
Mar 23, 2024

Conversation

DJAndries
Copy link
Collaborator

@DJAndries DJAndries commented Feb 21, 2024

Resolves brave/brave-browser#36243

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Only test for Windows and Android.

  1. Start with fresh profile, ensure metrics do not exist.
  2. Start again with fresh profile using the switch --enable-features="BraveDayZeroExperiment:variant/a". Ensure Brave.DayZero.A.InstallTime has value of 0.
  3. Close browser, advance system time by 7 days, start browser, ensure metric has value of 7.
  4. Close browser, advance system time by 14 days, start browser with --enable-features="BraveDayZeroExperiment:variant/b", ensure metric has value of 21, and Brave.DayZero.B.InstallTime does NOT exist
  5. Close browser advance system time by 14 days, start browser, ensure that the metric still has a value of 21 (to ensure that the metric was not updated internally).
  6. Start with fresh profile with --enable-features="BraveDayZeroExperiment:variant/b" switch
  7. Ensure Brave.DayZero.B.InstallTime has a value of 0.
  8. Close browser, advance system time by 7 days, start browser, ensure metric has value of 7.
  9. Close browser, advance system time by 14 days, start browser without --enable-features="BraveDayZeroExperiment:variant/b", ensure metric has value of 21, and Brave.DayZero.A.InstallTime does NOT exist
  10. Close browser advance system time by 14 days, start browser, ensure that the metric still has a value of 21 (to ensure that the metric was not updated internally).

Ensure the metrics only exist in the logs_constellation_prep_express pref.

@DJAndries DJAndries requested review from a team February 21, 2024 01:46
@github-actions github-actions bot added the CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux) label Feb 21, 2024
@DJAndries
Copy link
Collaborator Author

Will change base to master once #21583 lands.

@@ -31,6 +31,6 @@ public abstract class BraveFeatureList {
public static final String AI_CHAT = "AIChat";
public static final String BRAVE_SHOW_STRICT_FINGERPRINTING_MODE =
"BraveShowStrictFingerprintingMode";
public static final String BRAVE_ZERO_DAY_FLAG_ANDROID = "BraveZeroDayFlagAndroid";
public static final String BRAVE_DAY_ZERO_EXPERIMENT = "BraveDayZeroExperiment";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DJAndries the BRAVE_DAY_ZERO_EXPERIMENTvariable is the same variable cross platforms and as a replacement for the previous Android-specific one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, correct

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
void GeneralBrowserUsage::ReportInstallTime() {
int days_since_install = (base::Time::Now() - first_run_time_).InDays();
if (days_since_install < 0 || days_since_install > 30) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DJAndries this condition is to just keep the histogram putting users into 0-30 day buckets and anyone outside of this range, gets returned to the previous function, right? e.g. negative or >=31 will not be included.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's right. users outside of the 0-30 day range will not report either metric.

@chrismore
Copy link

@DJAndries If and when we want to bring this idea to Mac, will any of this approach work on Mac?

@DJAndries
Copy link
Collaborator Author

@DJAndries If and when we want to bring this idea to Mac, will any of this approach work on Mac?

Yes, once we add support for loading variations upon first run for Mac, it will work. We'll just need to make a couple tweaks.

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src++

@DJAndries DJAndries force-pushed the p3a-refcode branch 2 times, most recently from b0ff7c6 to b5cc650 Compare February 26, 2024 08:09
Base automatically changed from p3a-refcode to master February 26, 2024 22:36
@DJAndries DJAndries force-pushed the day-zero-p3a branch 2 times, most recently from d9b634d to a242dfd Compare March 21, 2024 22:02
@DJAndries DJAndries merged commit 6f30c85 into master Mar 23, 2024
19 checks passed
@DJAndries DJAndries deleted the day-zero-p3a branch March 23, 2024 01:00
@github-actions github-actions bot added this to the 1.66.x - Nightly milestone Mar 23, 2024
brave-builds added a commit that referenced this pull request Mar 26, 2024
DJAndries pushed a commit that referenced this pull request Apr 3, 2024
DJAndries added a commit that referenced this pull request Apr 3, 2024
@kjozwiak
Copy link
Member

kjozwiak commented Apr 11, 2024

Verification PASSED on Win 11 x64 using the following build(s):

Brave | 1.67.1 Chromium: 124.0.6367.29 (Official Build) nightly (64-bit)
-- | --
Revision | f4edcfc3cafa0d8609db03da09eb8582d83d1a27
OS | Windows 11 Version 23H2 (Build 22631.3374)

Test Case #1 - --enable-features=BraveDayZeroExperiment:variant/a

  • launched 1.67.1 Chromium: 124.0.6367.29 using --enable-features=BraveDayZeroExperiment:variant/a
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/a
  • ensured that StudyBraveDayZeroExperiment:GroupBraveDayZeroExperiment via brave://version

image

  • ensured that Brave.DayZero.A.InstallTime was 0 via brave://local-state
            "Brave.DayZero.A.InstallTime": {
               "sent": false,
               "value": "0"

image

  • closed the browser and moved the machines time/clock forwards by 7 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/a
  • ensured that Brave.DayZero.A.InstallTime was set as 7 via brave://local-state
            "Brave.DayZero.A.InstallTime": {
               "sent": false,
               "value": "7"
            },

image

  • closed the browser and moved the machines time/clock forwards by 14 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/b
  • ensured that Brave.DayZero.A.InstallTime was set as 21 via brave://local-state
  • ensured that Brave.DayZero.B.InstallTim doesn't exist under brave://local-state
            "Brave.DayZero.A.InstallTime": {
               "sent": false,
               "value": "21"
            },
Example Example
1 2
  • closed the browser and moved the machines time/clock forwards by 14 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/b
  • ensured that Brave.DayZero.A.InstallTime was set as 21 via brave://local-state
  • ensured that Brave.DayZero.B.InstallTim doesn't exist under brave://local-state
            "Brave.DayZero.A.InstallTime": {
               "sent": false,
               "value": "21"
            },

3

Test Case #2 - --enable-features=BraveDayZeroExperiment:variant/b

  • launched 1.67.1 Chromium: 124.0.6367.29 using --enable-features=BraveDayZeroExperiment:variant/b
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/b
  • ensured that StudyBraveDayZeroExperiment:GroupBraveDayZeroExperiment via brave://version

1

  • ensured that Brave.DayZero.B.InstallTime was 0 via brave://local-state
            "Brave.DayZero.B.InstallTime": {
               "sent": false,
               "value": "0"
            },

2

  • closed the browser and moved the machines time/clock forwards by 7 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/b
  • ensured that Brave.DayZero.B.InstallTime was set as 7 via brave://local-state
            "Brave.DayZero.B.InstallTime": {
               "sent": false,
               "value": "7"
            },

3

  • closed the browser and moved the machines time/clock forwards by 14 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/a
  • ensured that Brave.DayZero.B.InstallTime was set as 21 via brave://local-state
  • ensured that Brave.DayZero.A.InstallTim doesn't exist under brave://local-state
            "Brave.DayZero.B.InstallTime": {
               "sent": false,
               "value": "21"
            },
Example Example
4 5
  • closed the browser and moved the machines time/clock forwards by 14 days
  • re-launched once again using --enable-features=BraveDayZeroExperiment:variant/a
  • ensured that Brave.DayZero.B.InstallTime was set as 21 via brave://local-state
  • ensured that Brave.DayZero.A.InstallTim doesn't exist under brave://local-state
            "Brave.DayZero.B.InstallTime": {
               "sent": false,
               "value": "21"
            },

6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "day zero" experiment daily retention P3A metric
5 participants