Skip to content

Add FXIOS-12509 [TA 2025] Add event for history migration and rework logic to only migrate on upgrades, not fresh installs #27267

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ih-codes
Copy link
Collaborator

📜 Tickets

Jira ticket
Github issue

💡 Description

We wanted to add an event to know how often we are firing application services history migration code from v110.

Preexisting telemetry was not serviceable and was removed in #27211.

This PR adds a new event to check how many users are using the history migration code. The logic was also reworked to only attempt migration if the app is not a fresh install.

We will be able to delete this code (and the event) if usage is none or very low.

Indentation was fixed + Sentry logs were updated for current best practices (parameters passed as extras instead of part of the event text).

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If needed, I updated documentation and added comments to complex code
  • If needed, I added a backport comment (example @Mergifyio backport release/v120)

@ih-codes ih-codes requested a review from lmarceau June 11, 2025 22:12
@ih-codes ih-codes requested a review from a team as a code owner June 11, 2025 22:12
Comment on lines +184 to +191
let isFirstRun = introScreenManager.shouldShowIntroScreen

// If this is a first run, there won't be history to migrate since we are far past v110
guard !isFirstRun else {
// Mark migration as succeeded and return early
UserDefaults.standard.setValue(true, forKey: PrefsKeys.PlacesHistoryMigrationSucceeded)
return
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cc @OrlaM and @lmarceau with regards to our slack conversation today

Do either of you foresee any issues with me hooking into introScreenManager.shouldShowIntroScreen to determine if this is the first time the app has been launched?

My thinking is that we should always mark migration as complete for first launch of the app. That way we can record the telemetry event just when an actual migration is potentially needed (i.e. an upgrade).

Copy link
Contributor

Choose a reason for hiding this comment

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

The other thing maybe we could use is InstallType.fresh ? But that's setup in setUpPostLaunchDependencies. Otherwise I think it's a fair trade to use the introScreenManager.shouldShowIntroScreen

@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Jun 11, 2025

Messages
📖 Project coverage: 35.83%
📖 Edited 5 files
📖 Created 2 files

Client.app: Coverage: 35.38

File Coverage
HistoryTelemetry.swift 0.0% ⚠️
AppLaunchUtil.swift 0.0% ⚠️

Generated by 🚫 Danger Swift against a920dce

@ih-codes
Copy link
Collaborator Author

cc @adudenamedruby

Request for data collection review form

All questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.

  1. What questions will you answer with this data?

We want to know if we can remove our code related to the application services history migration for v110.

  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? Some example responses:

This will help us improve the maintainability of our code as we can remove legacy / unused migration code.

  1. What alternative methods did you consider to answer these questions? Why were they not sufficient?

We tried to use preexisting telemetry to answer these questions, but we could only infer usage at best. Moreover, the logic for when the telemetry was recorded was insufficient for the questions we had (migration telemetry was recorded on every first launch of the app, regardless of whether a migration was in fact performed).

  1. Can current instrumentation answer these questions?

No.

  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories found on the Mozilla wiki.

Note that the data steward reviewing your request will characterize your data collection based on the highest (and most sensitive) category.

Measurement Description Data Collection Category Tracking Bug #
history.migration_2022.migration_attempted 1 FXIOS-12509
  1. Please provide a link to the documentation for this data collection which describes the ultimate data set in a public, complete, and accurate way.

This collection is documented in the Glean Dictionary at https://dictionary.telemetry.mozilla.org/

  1. How long will this data be collected? Choose one of the following:

Only for a few months. As long as usage is low, we can remove this event.

  1. What populations will you measure?

New users and existing users. Release channel, all countries.

  1. If this data collection is default on, what is the opt-out mechanism for users?

User has the general option of disable telemetry or/and studies.

  1. Please provide a general description of how you will analyze this data.

We will use event volume to determine whether we can retire old migration code.

  1. Where do you intend to share the results of your analysis?

Mozilla Internal (Product and Dev Team).

  1. Is there a third-party tool (i.e. not Glean or Telemetry) that you are proposing to use for this data collection? If so:

No. We will collect the info using Glean. We will analyze the data with the traditional Looker/SQL database that Mozilla uses for all other telemetry.

@ih-codes
Copy link
Collaborator Author

FYI I omitted unit tests for this telemetry because it's expected to be short-lived.

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