# 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 :: Profiles'

browser.backup:
  enabled:
    type: boolean
    description: >
      True if the BackupService has initialized and reached idle. You may want
      to use archive_enabled/restore_enabled to determine whether those
      features are available, or use scheduler_enabled for whether automatic
      backups are enabled.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  archive_enabled:
    type: boolean
    description: >
      True if the user can create backups, i.e. it has not been disabled by a
      pref or otherwise deemed incompatible.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1997389
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1997389
    data_sensitivity:
      - technical
    notification_emails:
      - drubino@mozilla.com
    expires: never

  restore_enabled:
    type: boolean
    description: >
      True if the user can restore backups, i.e. it has not been disabled by a
      pref or otherwise deemed incompatible.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1997389
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1997389
    data_sensitivity:
      - technical
    notification_emails:
      - drubino@mozilla.com
    expires: never

  scheduler_enabled:
    type: boolean
    description: >
      True if the BackupService is configured to automatically create backups
      in the background.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  scheduler_toggle_source:
    type: string
    lifetime: user
    description: >
      Identifies the UI that caused the most recent change to whether
      scheduled backups are enabled. Pair with scheduler_enabled to disambiguate:
      when scheduler_enabled is true this is the surface that turned backup on;
      when scheduler_enabled is false this is the surface that turned backup off.
      Set to "preferences" for the main backup settings page. If toggled by a
      message, the message ID is reported. Defaults to "unknown" when the
      toggling surface did not provide attribution (e.g., a direct pref flip).
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2038259
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2038259
    data_sensitivity:
      - technical
    send_in_pings:
      - metrics
    notification_emails:
      - drubino@mozilla.com
    expires: never

  pswd_encrypted:
    type: boolean
    description: >
      True if the BackupService is configured to encrypt backups.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  location_on_device:
    type: quantity
    unit: enum (see description)
    description: >
      1 = the default location, 2 = a non-default location
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908727
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  prof_d_disk_space:
    type: quantity
    unit: kilobyte
    description: >
      The total disk space available on the storage device that the profile
      directory is stored on. To reduce fingerprintability, we round to the
      nearest 10 megabytes and return the result in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1884407
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1884407
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  total_backup_size:
    type: memory_distribution
    memory_unit: megabyte
    description: >
      The total uncompressed size of all profile data included in a
      completed backup. To reduce fingerprintability, we round to the
      nearest 1 mebibyte.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1887765
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1887765
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  compressed_archive_size:
    type: memory_distribution
    memory_unit: megabyte
    description: >
      The total compressed size of a single-file profile data backup archive.
      To reduce fingerprintability, we round to the nearest 1 mebibyte.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1907625
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1907625
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  total_backup_time:
    type: timing_distribution
    time_unit: millisecond
    description: >
      Total time elapsed, in milliseconds, between the start and end
      of the profile backup creation process
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  places_size:
    type: quantity
    unit: kilobyte
    description: >
      The total file size of the places.sqlite db located in the current profile
      directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883642
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883642
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  places_time:
    type: timing_distribution
    time_unit: millisecond
    description: >
      Total time, in milliseconds, required to back up a profile's places
      database.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  favicons_size:
    type: quantity
    unit: kilobyte
    description: >
      The total file size of the favicons.sqlite db located in the current profile
      directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883642
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883642
    notification_emails:
      - mconley@mozilla.com
    expires: never

  favicons_time:
    type: timing_distribution
    time_unit: millisecond
    description: >
      Total time, in milliseconds, required to back up a profile's favicons
      database.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1891146
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  credentials_data_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of logins, payment method, and form autofill related files
      in the current profile directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883736
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883736
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  security_data_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of files needed for NSS initialization parameters and security
      certificate settings in the current profile directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883736
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883736
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  preferences_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of files relating to user preferences and permissions in the current profile
      directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883739
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883739
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  misc_data_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of files for telemetry, site storage, media device origin mapping,
      chrome privileged IndexedDB databases, and Mozilla Accounts in the current profile directory,
      rounded to the nearest tenth kilobyte.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883747
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1887746
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883747
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1887746
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  cookies_size:
    type: quantity
    unit: kilobyte
    description: >
      The total file size of the cookies.sqlite db located in the current profile
      directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  form_history_size:
    type: quantity
    unit: kilobyte
    description: >
      The file size of the formhistory.sqlite db located in the current profile
      directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  session_store_backups_directory_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of the session store backups directory, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  session_store_size:
    type: quantity
    unit: kilobyte
    description: >
      The size of uncompressed session store json, in kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883740
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  extensions_json_size:
    type: quantity
    unit: kilobyte
    description: >
      The total file size of the current profiles extensions metadata files,
      rounded to the nearest 10 kilobytes.
      Files included are:
        - extensions.json
        - extension-settings.json
        - extension-preferences.json
        - addonStartup.json.lz4
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  extension_store_permissions_data_size:
    type: quantity
    unit: kilobyte
    description: >
      The file size of the current profiles extension-store-permissions/data.safe.bin
      file, rounded to the nearest 10 kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  storage_sync_size:
    type: quantity
    unit: kilobyte
    description: >
      The file size of the current profiles storage-sync-v2.sqlite db,
      rounded to the nearest 10 kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  browser_extension_data_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of the current profiles storage.local legacy JSON backend
      in the browser-extension-data directory, rounded to the nearest 10 kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  extensions_xpi_directory_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of the current profiles extensions directory,
      rounded to the nearest 10 kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  extensions_storage_size:
    type: quantity
    unit: kilobyte
    description: >
      The total size of all extensions storage directories,
      rounded to the nearest 10 kilobytes.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1883655
    data_sensitivity:
      - technical
    notification_emails:
      - mconley@mozilla.com
    expires: never

  toggle_on:
    type: event
    description: >
      Dispatched when scheduled backups are enabled.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      encrypted:
        type: boolean
        description: Whether or not encryption is enabled.
      location:
        type: string
        description: >
          The location of the backup. This can be either "onedrive",
          "documents", or "other". "other" will be sent if the parent directory
          of the backup doesn't match the default "documents" or "onedrive"
          save paths.

  toggle_off:
    type: event
    description: >
      Dispatched when scheduled backups are disabled.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never

  created:
    type: event
    description: >
      Dispatched when a backup is successfully created.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - technical
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      encrypted:
        type: boolean
        description: Whether or not encryption is enabled for the backup.
      location:
        type: string
        description: >
          The location of the backup. This can be either "onedrive",
          "documents", or "other". "other" will be sent if the parent directory
          of the backup doesn't match the default "documents" or "onedrive"
          save paths.
      size:
        type: quantity
        description: >
          The size-on-disk of the created backup. This is rounded to the
          nearest mebibyte to reduce fingerprintability.

  change_location:
    type: event
    description: >
      Dispatched when the backup destination location is changed.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never

  password_changed:
    type: event
    description: >
      Dispatched when the backup encryption password is changed.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never

  password_added:
    type: event
    description: >
      Dispatched when the backup encryption is enabled.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never

  password_removed:
    type: event
    description: >
      Dispatched when the backup encryption is removed.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never

  error:
    type: event
    description: >
      Dispatched when a backup fails to be created. We encode the error code
      as well as the stage the backup failed in in the extra data.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1908732
    data_sensitivity:
      - interaction
    send_in_pings:
      - events
    notification_emails:
      - mconley@mozilla.com
    expires: never
    extra_keys:
      error_code:
        type: string
        description: The string representation of the error code.
      backup_step:
        type: string
        description: >
          The string representation of the step that backup creation was in
          when the error occurred.

  backup_start:
    type: event
    description: >
      Dispatched when a backup is initiated.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - interaction
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      reason:
        type: string
        description: >
          The reason that the backup was started. Can be one of the following:
            - "manual" if the user selected "Backup Now";
            - "idle" if the user was idle and sufficiently long passed since
              the last backup;
            - "missed" if the user was idle, sufficiently long has passed since
              the last backup, and this backup was scheduled to happen before;
            - "user deleted some data" if cookies or other user data was
              deleted;
            - "encryption" if the password was added, changed, or removed;
            - "location" if the location changed (not implemented yet, see
              bug 1996377);
            - "first" if scheduled backups were just enabled;
            - or "unknown" if the reason wasn't specified.

  backup_throttled:
    type: event
    description: >
      Dispatched when backups are throttled due to too many errors.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - technical
    notification_emails:
      - drubino@mozilla.com
    expires: never

  archive_disabled_reason:
    type: string
    description: >
      Only set if `browser.backup.enabled` is `false`. Possible reasons are
      "nimbus", "pref" (non-Nimbus), "policy", "sanitizeOnShutdown", "os version".
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - technical
    notification_emails:
      - drubino@mozilla.com
    expires: never

  restore_disabled_reason:
    type: string
    description: >
      Only set if `browser.backup.enabled` is `false`. Possible reasons are
      "nimbus", "pref" (non-Nimbus), "policy", "sanitizeOnShutdown".
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992808
    data_reviews:
      - https://phabricator.services.mozilla.com/D268774
    data_sensitivity:
      - technical
    notification_emails:
      - drubino@mozilla.com
    expires: never

  restore_file_chosen:
    type: event
    description: Dispatched when a file is chosen to be restored.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - interaction
    send_in_pings:
      - profile-restore
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      location:
        type: string
        description: >
          The location of the restore file. This can be either "onedrive",
          "documents", or "other". "other" will be sent if the file's parent
          directory doesn't match the default "documents" or "onedrive" save
          paths.
      valid:
        type: boolean
        description: >
          If `false`, the selected restore file was invalid and could not be
          restored. In this case, keys besides this one and `location` will not
          be specified.
      backup_timestamp:
        type: quantity
        description: >
          The number of milliseconds between the epoch and the creation of the
          backup.
      restore_id:
        type: string
        description: The identifier for the potential profile restore event.
      encryption:
        type: boolean
        description: >
          `true` if the restore file chosen is encrypted.
      app_name:
        type: string
        description: The name of the application that created the backup file.
      version:
        type: string
        description: The application version that created the backup file.
      build_id:
        type: string
        description: The build ID of the application that created the backup.
      os_name:
        type: string
        description: The OS in which the backup was created.
      os_version:
        type: string
        description: The OS version in which the backup was created.
      os_build_number:
        type: string
        description: >
          The OS build number from the machine that created the backup. On
          Windows, build numbers >= 22000 indicate Windows 11.
      telemetry_enabled:
        type: boolean
        description: Whether telemetry was enabled when the backup was created.

  restore_started:
    type: event
    description: Dispatched when the user starts the restore of the selected backup file.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - interaction
    send_in_pings:
      - profile-restore
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      restore_id:
        type: string
        description: The identifier for the potential profile restore event.
      replace:
        type: boolean
        description: Indicates if the restore will replace the current running profile.
      backup_version:
        type: string
        description: The application version that created the backup file.
      backup_os_name:
        type: string
        description: The OS name from the machine that created the backup.
      backup_os_version:
        type: string
        description: The OS version from the machine that created the backup.
      backup_os_build_number:
        type: string
        description: >
          The OS build number from the machine that created the backup. On
          Windows, build numbers >= 22000 indicate Windows 11.

  restore_failed:
    type: event
    description: Dispatched when a restore fails (prior to Firefox restart).
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - technical
    send_in_pings:
      - profile-restore
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      restore_id:
        type: string
        description: The identifier for the potential profile restore event.
      error_type:
        type: string
        description: >
          The reason for the failure. Possible values include, but are not
          limited to, "UNAUTHORIZED" (bad password provided by user),
          "CORRUPTED_ARCHIVE", "DECOMPRESSION_FAILED",
          "PROFILE_CREATION_FAILED", "RESOURCE_RECOVERY_FAILED",
          and "FILE_SYSTEM_ERROR".
      error_detail:
        type: string
        description: >
          Additional detail about the failure. For RESOURCE_RECOVERY_FAILED,
          this contains the resource key that failed (e.g.
          "PlacesBackupResource"). For other non-BackupError exceptions,
          this contains the error message (truncated to 100 characters).
          Empty string if not applicable.
      restore_step:
        type: string
        description: >
          The step that restore was in when the failure occurred. For
          resource-specific failures, value is
          "RECOVER_RESOURCE:{resourceKey}".
      backup_version:
        type: string
        description: The application version that created the backup file.
      backup_os_name:
        type: string
        description: The OS name from the machine that created the backup.
      backup_os_version:
        type: string
        description: The OS version from the machine that created the backup.
      backup_os_build_number:
        type: string
        description: >
          The OS build number from the machine that created the backup. On
          Windows, build numbers >= 22000 indicate Windows 11.

  restore_complete:
    type: event
    description: >
      Dispatched when a restore completes, just before the browser restarts into
      the restored profile.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - interaction
    send_in_pings:
      - profile-restore
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      restore_id:
        type: string
        description: The identifier for the potential profile restore event.
      backup_version:
        type: string
        description: The application version that created the backup file.
      backup_os_name:
        type: string
        description: The OS name from the machine that created the backup.
      backup_os_version:
        type: string
        description: The OS version from the machine that created the backup.
      backup_os_build_number:
        type: string
        description: >
          The OS build number from the machine that created the backup. On
          Windows, build numbers >= 22000 indicate Windows 11.

  backup_detection_complete:
    type: event
    description: >
      Dispatched when Firefox finishes looking for backup files in known locations.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2028360
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2028360
    data_sensitivity:
      - technical
    send_in_pings:
      - profile-restore
    notification_emails:
      - hsohaney@mozilla.com
    expires: never
    extra_keys:
      count:
        type: quantity
        description: >
          The number of backups detected. This will be zero if there are no
          backups detected.
      backup_timestamp:
        type: quantity
        description: >
          If one or more backups are detected, the most recent backup timestamp
          from among the detected backups, recorded as the number of
          milliseconds between the epoch and the creation of the backup.
      location:
        type: string
        description: >
          If one or more backups are detected, the location of the backup with
          the most recent timestamp. This can be either "onedrive",
          "documents", or "other". "other" will be sent if the file's parent
          directory doesn't match the default "documents" or "onedrive" save
          paths.
      source:
        type: string
        description: >
          Which part of Firefox ran the backup detection. Currently this can be
          "onboarding" or "preferences".
      restore_id:
        type: string
        description: >
          A unique identifier which is then reused in subsequent
          profile-restore events and the one post-profile-restore event.

  restored_profile_launched:
    type: event
    description: >
      Dispatched when a restore completes, after the browser restarts into the
      restored profile (from that profile). Note that this will not be sent if
      the new profile has telemetry disabled.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - interaction
    send_in_pings:
      - post-profile-restore
    notification_emails:
      - drubino@mozilla.com
    expires: never
    extra_keys:
      restore_id:
        type: string
        description: The identifier for the potential profile restore event.

  restored_profile_data:
    type: object
    description: >
      Describes the backup that was restored to make the current profile. If
      This is not a restored profile, `is_restored` will be set to `false` and
      no other values will be set.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1992809
    data_sensitivity:
      - technical
    send_in_pings:
      - metrics
    lifetime: application
    notification_emails:
      - drubino@mozilla.com
    expires: never
    structure:
      type: object
      properties:
        is_restored:
          type: boolean
        backup_timestamp:
          type: number
        backup_app_name:
          type: string
        backup_app_version:
          type: string
        backup_build_id:
          type: string
        backup_os_name:
          type: string
        backup_os_version:
          type: string
        backup_os_build_number:
          type: string
        backup_legacy_client_id:
          type: string
        intermediate_profile_creation_date:
          type: number
        restore_source:
          type: string
