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

Uplift P3A search engine switch P3A to 1.32.x #10625

Merged
merged 9 commits into from
Oct 22, 2021
Merged

Conversation

rillian
Copy link
Contributor

@rillian rillian commented Oct 20, 2021

Uplift #10300 to beta so we get measurements on Brave Search rollout sooner.

Resolves brave/brave-browser#18224

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • 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, npm run lint, 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:

See #10300.

rillian and others added 9 commits October 20, 2021 13:11
Add a P3A probe to record when the default search engine is changed,
and whether it's a transition between Brave Search or one of the
other major services. This helps understand what options are seem
better to users.

Keep track of the previous default search engine url. The event
the tracker observes only indicates something has changed, and
by then the previous state is no longer accessible; we need this
to correctly mark the transition in our matrix, separate from
whatever the original default was at startup.

Move the actual record step into an object method so it can access
the saved previous default. This simplifies calling it at startup
to set the initial kNoSwitch answer.

Note: this means we only report a change if the ping is sent from
the same application instance. We don't reset to kNoSwitch at the
end of the weekly sample cadence, and restarting the browser always
resets.

Closes brave/brave-browser#18224
Add a browser test to verify we record transitions as expected.
This is a helper class to record events for later P3A reporting.

It remembers a sequence of enum values for a week, and can return
the most recently-added value within that time period, if any.
Use WeeklyEventStorage to keep track of default search engine
changes over the previous week, so we can return an accurate
report of whether a switch happened during the P3A measurement
period.

This registers a new pref to back the WeeklyEventStorage data.
Like the other SearchEngineTracker browser test, this gives unstable
results in ci, tracked in brave/brave-browser#13057.

Disable the test for now, and remove the `MergeHistogramDeltasForTesting`
which we don't expect is necessary and made no difference in testing.
Specialize WeeklyEventStorage to use the basic `int` type for
event codes, rather than being a template class. The removes
type information at call sites using an `enum class` but also
reduces code bloat, which we prefer.
- Document the motivation for setting the region.
- Fix a comment typo.
@rillian rillian requested a review from iefremov as a code owner October 20, 2021 20:15
@rillian rillian added this to the 1.32.x - Beta milestone Oct 20, 2021
@kjozwiak kjozwiak requested a review from a team October 21, 2021 04:19
Copy link
Member

@kjozwiak kjozwiak left a comment

Choose a reason for hiding this comment

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

Uplift into 1.32.x approved after deliberating with @brave/uplift-approvers. QA has verified the PR on Nightly as per #10300 (comment).

@kjozwiak kjozwiak merged commit ac01931 into 1.32.x Oct 22, 2021
@kjozwiak kjozwiak deleted the p3a-search-switch-1.32.x branch October 22, 2021 15:04
@rillian rillian removed the request for review from iefremov October 22, 2021 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants