Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

3869 fix default search engine #6197

Conversation

severinrudie
Copy link
Contributor

@severinrudie severinrudie commented Oct 22, 2019


NOTE: this does not close #3869, which is still blocked on getting an API key. This completes the prework so we will be able to just swap the key in and close.

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
    No user facing changes
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features
    No user facing changes

After merge

  • Milestone: Make sure issues finished by this pull request are added to the milestone of the version currently in development.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@codecov-io
Copy link

codecov-io commented Oct 23, 2019

Codecov Report

Merging #6197 into master will decrease coverage by 0.07%.
The diff coverage is 38.09%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #6197      +/-   ##
===========================================
- Coverage     16.48%   16.4%   -0.08%     
+ Complexity      353     352       -1     
===========================================
  Files           276     276              
  Lines         11146   11206      +60     
  Branches       1602    1608       +6     
===========================================
+ Hits           1837    1838       +1     
- Misses         9155    9214      +59     
  Partials        154     154
Impacted Files Coverage Δ Complexity Δ
.../mozilla/fenix/search/awesomebar/AwesomeBarView.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...in/java/org/mozilla/fenix/search/SearchFragment.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...enix/settings/search/SearchEngineListPreference.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...la/fenix/components/metrics/GleanMetricsService.kt 8.12% <50%> (+0.32%) 3 <0> (ø) ⬇️
.../java/org/mozilla/fenix/search/SearchController.kt 73.46% <54.54%> (-19.87%) 0 <0> (ø)
...c/main/java/org/mozilla/fenix/components/Search.kt 92% <93.33%> (+1.09%) 1 <0> (ø) ⬇️
...mozilla/fenix/components/metrics/ActivationPing.kt 45.9% <0%> (-11.48%) 6% <0%> (-2%)
...pp/src/main/java/org/mozilla/fenix/HomeActivity.kt 7.69% <0%> (-0.8%) 7% <0%> (+1%)
...va/org/mozilla/fenix/components/metrics/Metrics.kt 26.04% <0%> (-0.47%) 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f50e2a...d20cfd7. Read the comment docs.

}
code.set(defaultEngine.identifier)
name.set(defaultEngine.name)
submissionUrl.set(defaultEngine.buildSearchUrl(""))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, these properties are only used to send this ping, so making this async shouldn't change any behavior.

*
* Cache hits/misses are reported to telemetry.
*/
private fun getCurrentSearchEngine(context: Context): SearchEngine {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See commit message for an explanation as to why this approach was taken.

@severinrudie severinrudie force-pushed the 3869-fix-default-search-engine branch 2 times, most recently from 89df622 to 16708f3 Compare October 25, 2019 23:18
.getDefaultSearchEngine(context)

val cacheWasHit = selectedSearchEngine != null
Events.searchFragmentCacheAccess.set(cacheWasHit)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the first time I've added a new ping, would you please double check that I'm doing it properly?

@severinrudie
Copy link
Contributor Author

@boek data review

Request for data collection review form

  1. What questions will you answer with this data?
  • How frequently do users reach the SearchFragment without their location already having been cached?
  1. Why does Mozilla need to answer these questions? Are there benefits for users? Do we need this information to address product or business requirements?
  • If cache misses are frequent, we will need to find a new solution to the problem. If not, this is probably fine.
  1. What alternative methods did you consider to answer these questions? Why were they not sufficient?
  • This is the only way to determine this information.
  1. Can current instrumentation answer these questions?
  • No telemetry currently exists to answer these questions.
  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories on the Mozilla wiki.
Measurement Description Data Collection Category Tracking Bug #
When SearchFragment has been opened, whether or not our search engine lookup hits a warm cache 1 [Issue 3869](#3869
  1. How long will this data be collected?
  • Fenix engineering will monitor this data until 2020-03-01
  1. What populations will you measure?
  • All users with telemetry enabled, on release channel.
  1. If this data collection is default on, what is the opt-out mechanism for users?
  • There is an option in settings to stop sending usage data.
  1. Please provide a general description of how you will analyze this data.
  • The data will be analyzed through Redash queries and dashboards.
  1. Where do you intend to share the results of your analysis?
  • On Redash and with mobile teams.

@severinrudie severinrudie marked this pull request as ready for review October 28, 2019 16:29
SearchEngineManager now provides the default search engine when no name param is passed
Alternatives to this approach that I tried:

Approach: make searchEngineSource & defaultEngineSource nullable, launch an async call in onCreateView, and update them when possible.
Problems: a lot of code relies on these states always being available. In particular, I was concerned that this could introduce problems into some of our telemetry.

Approach: make EngineSource an argument to SearchFragment. Retrieve it before launching SearchFragment
Problems: SearchFragment can be started via intent. Taking this approach would hurt our cold startup time in that instance, which is a critical performance area. This also spread complex coroutine code across a lot of the codebase.
@@ -154,6 +154,16 @@ events:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
search_fragment_cache_access:
Copy link
Contributor

@boek boek Nov 8, 2019

Choose a reason for hiding this comment

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

Could you fill out the data request form for this? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a dummy, don't know how I missed it!

@boek boek added the needs:data-review PR is awaiting a data review label Nov 8, 2019
@severinrudie
Copy link
Contributor Author

Closing, as these changes will be made redundant by #5577. We expect that story to fix #3869

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs:data-review PR is awaiting a data review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Fenix not setting default search engine properly
3 participants