# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Adding a new metric? We have docs for that!
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Firefox :: Migration'

browser.migration:
  matched_extensions:
    type: string_list
    description: >
      Records a list of the Chrome extension IDs that were successfully
      matched to Firefox equivalents from the list downloaded from AMO.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1807023
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1807023
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  unmatched_extensions:
    type: string_list
    description: >
      Records a list of the Chrome extension IDs that were unsuccessfully
      matched to Firefox equivalents from the list downloaded from AMO.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1807023
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1807023
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  opened_wizard:
    type: event
    description: >
      Recorded when the migration wizard opens.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.opened#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: BrowserMigration_Opened_Wizard

  no_browsers_found_wizard:
    type: event
    description: >
      Recorded when the migration wizard reports that there are no
      browsers to migrate from.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.no_browsers_found#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: BrowserMigration_NoBrowsersFound_Wizard

  browser_selected_wizard:
    type: event
    description: >
      Recorded when the user selects a browser to migrate from.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.browser_selected#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the browser that was selected.
        type: string
    telemetry_mirror: BrowserMigration_BrowserSelected_Wizard

  profile_selected_wizard:
    type: event
    description: >
      Recorded when the user selects a profile to migrate from. If the
      browser doesn't support multiple profiles, this will not be
      recorded.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.profile_selected#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the browser that had a profile selected for it.
        type: string
    telemetry_mirror: BrowserMigration_ProfileSelected_Wizard

  resources_selected_wizard:
    type: event
    description: >
      Recorded when the user selects resources from the browser / profile
      to import.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.resources_selected#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the browser that had resources selected for it.
        type: string
      history:
        description: >
          "1" if history was selected. "0" otherwise.

        type: string
      formdata:
        description: >
          "1" if form data was selected. "0" otherwise.

        type: string
      passwords:
        description: >
          "1" if passwords was selected. "0" otherwise.

        type: string
      bookmarks:
        description: >
          "1" if bookmarks were selected. "0" otherwise.

        type: string
      payment_methods:
        description: >
          "1" if payment methods were selected. "0" otherwise.

        type: string
      extensions:
        description: >
          "1" if extensions were selected. "0" otherwise.

        type: string
      other:
        description: >
          A count of the number of other resource types that were selected.
        type: quantity
      configured:
        description: >
          "1" if Variant 2 of the new Migration Wizard was being used, and the list of resources was expanded. "0" otherwise.

        type: string
    telemetry_mirror: BrowserMigration_ResourcesSelected_Wizard

  linux_perms_wizard:
    type: event
    description: >
      Recorded if the user is on Linux and the browser is installed in a
      sandboxed environment that prevents it from reading other browser's
      data, and the user is presented with instructions and an option to
      grant the browser permission to read that other data.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.linux_perms#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the migrator that will perform the migration.
        type: string
    telemetry_mirror: BrowserMigration_LinuxPerms_Wizard

  safari_perms_wizard:
    type: event
    description: >
      Recorded if the user is on macOS, chose to migrate from Safari, and
      was presented with the page of the wizard requesting permission to
      read from the Safari profile folder.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.safari_perms#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: BrowserMigration_SafariPerms_Wizard

  safari_password_file_wizard:
    type: event
    description: >
      Recorded if the user is on macOS, chose to migrate from Safari, and
      was presented with the page of the wizard requesting to import
      passwords from a file. This only gets recorded in the new migration
      wizard.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.safari_password_file#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: BrowserMigration_SafariPasswordFile_Wizard

  chrome_password_file_wizard:
    type: event
    description: >
      Recorded if the user is importing from Chrome, and was presented with
      the page of the wizard requesting to import passwords from a file. This
      currently only gets shown on Windows.
    bugs:
      - https://bugzil.la/1960560
    data_reviews:
      - https://bugzil.la/1960560
    notification_emails:
      - mconley@mozilla.com
    expires: never

  migration_started_wizard:
    type: event
    description: >
      Recorded when the user begins a migration.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.migration_started#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the migrator that will perform the migration.
        type: string
      history:
        description: >
          "1" if history is being migrated. "0" otherwise.

        type: string
      formdata:
        description: >
          "1" if form data is being migrated. "0" otherwise.

        type: string
      passwords:
        description: >
          "1" if passwords are being migrated. "0" otherwise.

        type: string
      bookmarks:
        description: >
          "1" if bookmarks are being migrated. "0" otherwise.

        type: string
      payment_methods:
        description: >
          "1" if payment methods are being migrated. "0" otherwise.

        type: string
      extensions:
        description: >
          "1" if extensions are being migrated. "0" otherwise.

        type: string
      other:
        description: >
          A count of the number of other resource types that are being migrated.
        type: quantity
    telemetry_mirror: BrowserMigration_MigrationStarted_Wizard

  migration_finished_wizard:
    type: event
    description: >
      Recorded when the user finishes a migration.
      This event was generated to correspond to the Legacy Telemetry event
      browser.migration.migration_finished#wizard.
    bugs:
      - https://bugzil.la/1824786
    data_reviews:
      - https://bugzil.la/1824786
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      migrator_key:
        description: >
          The key of the migrator that will perform the migration.
        type: string
      history:
        description: >
          "1" if history was migrated. "0" otherwise.

        type: string
      formdata:
        description: >
          "1" if form data was migrated. "0" otherwise.

        type: string
      passwords:
        description: >
          "1" if passwords were migrated. "0" otherwise.

        type: string
      bookmarks:
        description: >
          "1" if bookmarks were migrated. "0" otherwise.

        type: string
      payment_methods:
        description: >
          "1" if payment methods were migrated. "0" otherwise.

        type: string
      extensions:
        description: >
          "1" if no extensions were matched, "2" if only some extensions were matched, "3" if all extensions were matched, and "0" if extensions weren't selected for migration.

        type: string
      other:
        description: >
          A count of the number of other resource types that were migrated.
        type: quantity
    telemetry_mirror: BrowserMigration_MigrationFinished_Wizard

  entry_point_categorical:
    type: labeled_counter
    description: >
      Where the migration wizard was entered from.

      This metric was generated to correspond to the Legacy Telemetry
      categorical histogram FX_MIGRATION_ENTRY_POINT_CATEGORICAL.
    labels:
      - unknown
      - firstrun
      - fxrefresh
      - places
      - passwords
      - newtab
      - file_menu
      - help_menu
      - bookmarks_toolbar
      - preferences
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1822692
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1822692
    notification_emails:
      - mconley@mozilla.com
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: h#FX_MIGRATION_ENTRY_POINT_CATEGORICAL

  source_browser:
    type: custom_distribution
    description: >
      The browser that data is pulled from. The values correspond to the
      internal browser ID (see MigrationUtils.sys.mjs)

      This metric was generated to correspond to the Legacy Telemetry enumerated
      histogram FX_MIGRATION_SOURCE_BROWSER.
    range_min: 0
    range_max: 15
    bucket_count: 16
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1523179
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1523179
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_SOURCE_BROWSER

  errors:
    type: labeled_custom_distribution
    description: >
      Errors encountered during migration in buckets defined by the datatype,
      keyed by the string description of the browser.

      This metric was generated to correspond to the Legacy Telemetry enumerated
      histogram FX_MIGRATION_ERRORS.
    range_min: 0
    range_max: 12
    bucket_count: 13
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_ERRORS

  usage:
    type: labeled_custom_distribution
    description: >
      Usage of migration for each datatype when migration is run through the
      post-firstrun flow which allows individual datatypes, keyed by the string
      description of the browser.

      This metric was generated to correspond to the Legacy Telemetry enumerated
      histogram FX_MIGRATION_USAGE.
    range_min: 0
    range_max: 12
    bucket_count: 13
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=731025
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_USAGE

  bookmarks_quantity:
    type: labeled_custom_distribution
    description: >
      How many bookmarks we imported from another browser, keyed by the name of
      the browser.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram FX_MIGRATION_BOOKMARKS_QUANTITY.
    range_min: 1
    range_max: 1000
    bucket_count: 20
    histogram_type: exponential
    unit: bookmarks
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_BOOKMARKS_QUANTITY

  history_quantity:
    type: labeled_custom_distribution
    description: >
      How many history visits we imported from another browser, keyed by the
      name of the browser.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram FX_MIGRATION_HISTORY_QUANTITY.
    range_min: 1
    range_max: 10000
    bucket_count: 40
    histogram_type: exponential
    unit: history visits
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_HISTORY_QUANTITY

  logins_quantity:
    type: labeled_custom_distribution
    description: >
      How many logins (passwords) we imported from another browser, keyed by the
      name of the browser.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram FX_MIGRATION_LOGINS_QUANTITY.
    range_min: 1
    range_max: 1000
    bucket_count: 20
    histogram_type: exponential
    unit: passwords
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1279501
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1584261
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1643431
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678204
    notification_emails:
      - gijs@mozilla.com
      - mak@mozilla.com
      - passwords-dev@mozilla.org
    expires: never
    telemetry_mirror: FX_MIGRATION_LOGINS_QUANTITY

  cards_quantity:
    type: labeled_custom_distribution
    description: >
      How many credit card entries we imported from another browser, keyed by
      the name of the browser.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram FX_MIGRATION_CARDS_QUANTITY.
    range_min: 1
    range_max: 1000
    bucket_count: 20
    histogram_type: exponential
    unit: credit card entries
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1834545
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1834545
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_CARDS_QUANTITY

  extensions_quantity:
    type: labeled_custom_distribution
    description: >
      How many extensions were matched to be imported from another browser,
      keyed by the name of the browser.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram FX_MIGRATION_EXTENSIONS_QUANTITY.
    range_min: 1
    range_max: 1000
    bucket_count: 20
    histogram_type: exponential
    unit: extensions
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1834545
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1834545
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: FX_MIGRATION_EXTENSIONS_QUANTITY

migration:
  uninstaller_profile_refresh:
    type: boolean
    description: >
      Set when a profile refresh is initiated from the uninstaller.
      This metric was generated to correspond to the Legacy Telemetry
      scalar migration.uninstaller_profile_refresh.
    bugs:
      - https://bugzil.la/1634115
      - https://bugzil.la/1672585
    data_reviews:
      - https://bugzil.la/1634115
      - https://bugzil.la/1672585
    notification_emails:
      - application-update-telemetry-alerts@mozilla.com
    expires: never
    telemetry_mirror: MIGRATION_UNINSTALLER_PROFILE_REFRESH

  discovered_migrators:
    type: labeled_counter
    description: >
      A keyed uint recording how many times the migration wizard detected
      a browser / profile pair for a particular browser. This is
      incremented every time the discovery occurs, so multiple openings of
      the wizard will increase the counts each time.
      This metric was generated to correspond to the Legacy Telemetry
      scalar migration.discovered_migrators.
    bugs:
      - https://bugzil.la/1825655
    data_reviews:
      - https://bugzil.la/1825655
    notification_emails:
      - mconley@mozilla.com
    expires: never
    telemetry_mirror: MIGRATION_DISCOVERED_MIGRATORS

  time_to_produce_migrator_list:
    type: timespan
    description: >
      The amount of time it took in milliseconds to produce the list of
      migrators and profiles for the first time the migration wizard
      opened during the process lifetime.
      This metric was generated to correspond to the Legacy Telemetry
      scalar migration.time_to_produce_migrator_list.
    bugs:
      - https://bugzil.la/1840917
    data_reviews:
      - https://bugzil.la/1840917
    notification_emails:
      - mconley@mozilla.com
    expires: never
    time_unit: millisecond
    telemetry_mirror: MIGRATION_TIME_TO_PRODUCE_MIGRATOR_LIST
