# 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:
  - 'Toolkit :: Add-ons Manager'

addons:
  active_addons:
    type: object
    lifetime: application
    description: |
      The list of currently enabled addons.

      Some of the addon fields are not available during startup. The fields
      that will always be present are id, version, addonType, updateDay, scope,
      isSystem, isWebExtension, and multiprocessCompatible. All the other
      fields become present shortly after the `sessionstore-windows-restored`
      observer topic is notified.

      This metric is an echo of the Legacy Telemetry Environment field
      addons.activeAddons. Like its counterpart, it will only have data in
      Firefox Desktop and at times and on platforms where the environment would
      have values.

      NOTE: this metric is available in both `metrics` and `addons` pings. However
      the `addons` ping is the preferred source of data for add-ons related analyses,
      whereas the `metrics` ping is better suited for analyses that correlates other
      metrics with the add-ons listed in the `active_addons` metric.
    bugs:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_reviews:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_sensitivity:
      - technical
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    no_lint:
      - COMMON_PREFIX
    structure:
      type: array
      items:
        type: object
        properties:
          id:
            type: string
          blocklisted:
            type: boolean
          description:
            type: string
          name:
            type: string
          userDisabled:
            type: boolean
          appDisabled:
            type: boolean
          version:
            type: string
          scope:
            type: number
          addonType:
            type: string
          foreignInstall:
            type: boolean
          hasBinaryComponents:
            type: boolean
          installDay:
            type: number
          updateDay:
            type: number
          signedState:
            type: number
          signedTypes:
            type: string
          isSystem:
            type: boolean
          isWebExtension:
            type: boolean
          multiprocessCompatible:
            type: boolean
          quarantineIgnoredByApp:
            type: boolean
          quarantineIgnoredByUser:
            type: boolean
    send_in_pings:
      - metrics
      - heartbeat
      - addons

  theme:
    type: object
    lifetime: application
    description: |
      The currently active theme.

      Some of the addon fields are not available during startup. The fields
      that will always be present are id, version, updateDay, and scope. All
      the other fields become present shortly after the
      `sessionstore-windows-restored` observer topic is notified.

      This metric is an echo of the Legacy Telemetry Environment field
      addons.theme. Like its counterpart, it will only have data in Firefox
      Desktop and at times and on platforms where the environment would have
      values.

      NOTE: this metric is available in both `metrics` and `addons` pings. However
      the `addons` ping is the preferred source of data for add-ons related analyses,
      whereas the `metrics` ping is better suited for analyses that correlates other
      metrics with the add-ons listed in the `theme` metric.
    bugs:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_reviews:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_sensitivity:
      - technical
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    structure:
      type: object
      properties:
         id:
           type: string
         blocklisted:
           type: boolean
         description:
           type: string
         name:
           type: string
         userDisabled:
           type: boolean
         appDisabled:
           type: boolean
         version:
           type: string
         scope:
           type: number
         foreignInstall:
           type: boolean
         hasBinaryComponents:
           type: boolean
         installDay:
           type: number
         updateDay:
           type: number
         signedState:
           type: number
         signedTypes:
           type: string
    send_in_pings:
      - metrics
      - addons

  active_g_m_plugins:
    type: object
    lifetime: application
    description: |
      The list of currently enabled Gecko Media Plugins.

      Some of the addon fields are not available during startup. The fields
      that will always be present are id and version. All the other
      fields become present shortly after the `sessionstore-windows-restored`
      observer topic is notified.

      This metric is an echo of the Legacy Telemetry Environment field
      addons.activeGMPlugins. Like its counterpart, it will only have data in
      Firefox Desktop and at times and on platforms where the environment would
      have values.
    bugs:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_reviews:
      - https://bugzilla.mozilla.org/1950416
      - https://bugzilla.mozilla.org/1991924
      - https://bugzilla.mozilla.org/2000866
    data_sensitivity:
      - technical
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    no_lint:
      - COMMON_PREFIX
    structure:
      type: array
      items:
        type: object
        properties:
          id:
            type: string
          version:
            type: string
          userDisabled:
            type: boolean
          applyBackgroundUpdates:
            type: number
    send_in_pings:
      - metrics
      - addons

addons_manager:
  install: &install_update_event
    type: event
    description: |
      These events are recorded during the install and update flow for
      extensions and themes.
    bugs:
      - https://bugzilla.mozilla.org/1433335
      - https://bugzilla.mozilla.org/1515697
      - https://bugzilla.mozilla.org/1523641
      - https://bugzilla.mozilla.org/1549770
      - https://bugzilla.mozilla.org/1590736
      - https://bugzilla.mozilla.org/1630596
      - https://bugzilla.mozilla.org/1672570
      - https://bugzilla.mozilla.org/1714251
      - https://bugzilla.mozilla.org/1749878
      - https://bugzilla.mozilla.org/1781974
      - https://bugzilla.mozilla.org/1817100
      - https://bugzilla.mozilla.org/1820153
      - https://bugzilla.mozilla.org/1912166
      - https://bugzilla.mozilla.org/1958151
      - https://bugzilla.mozilla.org/1994595
      - https://bugzilla.mozilla.org/2014567
      - https://bugzilla.mozilla.org/2041166
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1433335#c8
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820153#c3
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2014567
      - https://phabricator.services.mozilla.com/D306509
    data_sensitivity:
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    extra_keys:
      addon_id:
        description: Id of the addon (when available).
        type: string
      addon_type:
        description: |
          Addon type, one of: extension, theme, locale, dictionary,
          sitepermission, siteperm_deprecated, other, unknown.
        type: string
      install_id:
        description: |
          Shared by events related to the same install or update flow.
        type: string
      download_time:
        description: The number of ms needed to complete the download.
        type: quantity
      error:
        description: |
          The AddonManager error related to an install or update failure.
        type: string
      source:
        description: |
          The source that originally triggered the installation, one
          of: "about:addons", "about:debugging", "about:preferences",
          "amo", "browser-import", "disco", "distribution",
          "extension", "enterprise-policy", "file-url",
          "geckoview-app", "gmp-plugin", "internal", "plugin",
          "rtamo", "siteperm-addon-provider" "sync", "system-addon",
          "temporary-addon", "unknown", "about:editprofile", "about:newprofile",
          "nimbus-newtabTrainhopAddon".
          For events with method set to "sideload", the source value
          is derived from the XPIProvider location name (e.g. possible
          values are "app-builtin", "app-global", "app-profile",
          "app-system-addons", "app-system-defaults",
          "app-system-local", "app-system-profile",
          "app-system-share", "app-system-user", "winreg-app-user",
          "winreg-app-gobal").
        type: string
      source_method:
        description: |
          The method used by the source to install the add-on
          (included when the source can use more than one, e.g.
          install events with source "about:addons" may have
          "install-from-file" or "url" as method), one of: "amWebAPI",
          "drag-and-drop", "installTrigger", "install-from-file",
          "link", "management-webext-api", "sideload", "onboarding",
          "rtamo", "synthetic-install", "url", "product-updates",
          "FirefoxThemesList".
        type: string
      num_strings:
        description: |
          The number of permission description strings in the
          extension permission doorhanger.
        type: quantity
      updated_from:
        description: |
          Determine if an update has been requested by the user or
          the application ("app" / "user").
        type: string
      install_origins:
        description: |
          This flag indicates whether install_origins is defined in
          the addon manifest. ("1" / "0")
        type: string
      step:
        description: |
          The current step in the install or update flow: started,
          postponed, cancelled, failed, permissions_prompt, completed,
          site_warning, site_blocked,install_disabled_warning,
          download_started, download_completed, download_failed
        type: string
      site_permission:
        description: |
          Only set for site permission add-on installs. The gated
          permission being granted by this install flow, currently one of
          "serial", "midi", "midi-sysex".
        type: string
    expires: 161

  update: *install_update_event

  install_stats:
    type: event
    description: |
      These events are recorded at the end of the install flow, but only
      when the source that originally triggered the add-on installation
      is "amo", "rtamo" or "disco".
    bugs:
      - https://bugzilla.mozilla.org/1653020
      - https://bugzilla.mozilla.org/1699225
      - https://bugzilla.mozilla.org/1820153
      - https://bugzilla.mozilla.org/1982913
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1653020#c6
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820153#c3
      - https://bugzilla.mozilla.org/1982913
    data_sensitivity:
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    extra_keys:
      addon_id:
        description: Full id of the addon.
        type: string
      addon_type:
        description: Type of the add-on.
        type: string
      hashed_addon_id:
        description: The hashed addon id.
        type: string
      taar_based:
        description: |
          This extra key is only set for install flows related to the
          discovery addon. When available it is going to be a string
          set to "1" for TAAR based recommendations, "0" for manually
          curated and unset if not relevant for the particular
          install flow.
        type: string
      utm_campaign:
        description: |
          The specific product promotion or strategic campaign that
          drives traffic to the install page.
        type: string
      utm_content:
        description: |
          The specific item that a person clicks on to access the
          install page (such as an A/B test, a website banner, or a
          specific ad).
        type: string
      utm_medium:
        description: The channel used to share the install page.
        type: string
      utm_source:
        description: |
          The name of the product, domain of the website that drives
          traffic to the install page.
        type: string
    expires: never

  manage:
    type: event
    description: |
      This events are recorded when an installed add-ons is being
      disable/enabled/uninstalled.
    bugs:
      - https://bugzilla.mozilla.org/1433335
      - https://bugzilla.mozilla.org/1515697
      - https://bugzilla.mozilla.org/1523641
      - https://bugzilla.mozilla.org/1549770
      - https://bugzilla.mozilla.org/1590736
      - https://bugzilla.mozilla.org/1630596
      - https://bugzilla.mozilla.org/1672570
      - https://bugzilla.mozilla.org/1714251
      - https://bugzilla.mozilla.org/1749878
      - https://bugzilla.mozilla.org/1781974
      - https://bugzilla.mozilla.org/1817100
      - https://bugzilla.mozilla.org/1820153
      - https://bugzilla.mozilla.org/1912166
      - https://bugzilla.mozilla.org/1917859
      - https://bugzilla.mozilla.org/1958149
      - https://bugzilla.mozilla.org/1994595
      - https://bugzilla.mozilla.org/2041166
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1433335#c8
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820153#c3
      - https://phabricator.services.mozilla.com/D224982
      - https://phabricator.services.mozilla.com/D306509
    data_sensitivity:
      - interaction
    notification_emails:
      - addons-dev-internal@mozilla.com
    extra_keys:
      addon_id:
        description: Id of the addon being managed.
        type: string
      addon_type:
        description: The type of the add-on being managed.
        type: string
      method:
        description: |
          One of: disable, enable, sideload_prompt, uninstall.
        type: string
      source:
        description: |
          The source from which the addon has been installed.
          See extra_keys.source description from install event.
        type: string
      source_method:
        description: |
          The method used by the source to install the add-on
          (included when the source can use more than one, e.g.
          install events with source "about:addons" may have
          "install-from-file" or "url" as method).
        type: string
      num_strings:
        description: |
          The number of permission description strings in the
          extension permission doorhanger.
        type: quantity
      blocklist_state:
        description: |
          The add-on blocklistState (0 not-blocked, 1 soft-blocked, 2
          hard-blocked) at the time the manage event was being collected.
        type: string
    expires: 161

  report_suspicious_site:
    type: event
    description: |
      Sent when a user clicks "Report Suspicious Site" on the dropdown
      menu of the third-party xpinstall doorhanger.
    bugs:
      - https://bugzilla.mozilla.org/1806056
      - https://bugzilla.mozilla.org/1817100
      - https://bugzilla.mozilla.org/1820153
      - https://bugzilla.mozilla.org/1912166
      - https://bugzilla.mozilla.org/1958151
      - https://bugzilla.mozilla.org/1994595
      - https://bugzilla.mozilla.org/2041166
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1806056#c3
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820153#c3
      - https://phabricator.services.mozilla.com/D306509
    data_sensitivity:
      - stored_content
    notification_emails:
      - addons-dev-internal@mozilla.com
    extra_keys:
      suspicious_site:
        description: The domain of the site that was reported.
        type: string
      permission_type:
        description: The permission that the site was requesting.
        type: string
    expires: 161

  compatibility_check_enabled:
    type: boolean
    lifetime: application
    description: |
      Whether application compatibility is enforced for add-ons.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1950389
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1950389
    data_sensitivity:
      - technical
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never

  xpistates_write_errors:
    type: event
    description: |
      Sent when saving addonStartup.json.lz4 data back to disk fails.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1966154
      - https://bugzilla.mozilla.org/1994595
      - https://bugzilla.mozilla.org/2041166
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1966154
      - https://phabricator.services.mozilla.com/D306509
    data_sensitivity:
      - technical
    notification_emails:
      - addons-dev-internal@mozilla.com
    extra_keys:
      error_type:
        description: |
          A string set to determine which kind of errors originated from IOUtils.writeJSON
          was hit by JSONFile.save. The expected values are:
          - "TooMuchRecursion" (if the error hit was an "too much recursion" InternalError
          - the value set on `name` property of the error object instance
          - "Unknown" as a fallback if the error object did not have a `name` property and
            it wasn't detected as a "too much recursion" error.
        type: string
      profile_state:
        description: |
          A string set to determine whether the profile was a new or existing profile,
          and if the application version was changing, while the write error was hit.
          The expected values are: "new", "existing" "existingWithVersionChanged"
        type: string
    expires: 161

  startup_timeline:
    type: labeled_quantity
    unit: milliseconds since process creation
    lifetime: application
    description: |
      Events on the startup timeline, in millis since process creation.
      Previously carried in Legacy "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical
    labels:
      - AMI_startup_begin
      - AMI_startup_end
      - XPI_startup_begin
      - XPI_bootstrap_addons_begin
      - XPI_bootstrap_addons_end
      - XPI_finalUIStartup
      - XPI_startup_end

  exception:
    type: object
    lifetime: application
    description: |
      Most recent exception reported by the Addons Manager this app session.
      Previously reported in the "main" ping `simpleMeasurements`.
      ```text
      {
        module: string module name,
        context: string context, like the method name,
        message: string message of the exception,
        file: the file that the exception occured in,
        line: the line number the exception was thrown from,
      }
      ```
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical
    structure:
      type: object
      properties:
        module:
          type: string
        context:
          type: string
        message:
          type: string
        file:
          type: string
        line:
          type: number


blocklist:
  last_modified_rs_addons_mblf:
    type: datetime
    description: >
      Keep track of the last time the "addons-bloomfilters" remotesetting
      blocklist has been successfully updated.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1572711
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1607744
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1649960
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1689274
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1607744#c11
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
    data_sensitivity:
      - technical
    metadata:
      tags:
        - 'Toolkit :: Blocklist Implementation'
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  mlbf_source: &mlbf_source
    type: string
    description: >
      The source of the RemoteSettings attachment that
      holds the bloom filter. Possible values are "dump_match",
      "cache_match", "remote_match","dump_fallback", "cache_fallback",
      "unknown". "dump_match", "cache_match" and "remote_match"
      are expected known-good values, and means that the loaded
      bloomfilter matches the blocklist record in
      the RemoteSettings collection. The prefix denotes
      the immediate source of the loaded data: "dump"
      means packaged with the application, "remote"
      means a freshly downloaded bloomfilter, "cache"
      means a previously downloaded bloomfilter. "dump_fallback"
      and "cache_fallback" means that the last known bloomfilter
      was used, despite it not matching the latest record
      in the RemoteSettings collection. In this case
      the outdated bloomfilter is used as a fallback
      (e.g. because the latest version cannot be downloaded).
      "unknown"  means that the bloomfilter cannot
      be loaded at all. This can happen if the blocklist
      is disabled via preferences or enterprise policies.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662857
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
      - https://bugzilla.mozilla.org/2018311/
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662857#c11
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
      - https://bugzilla.mozilla.org/2018311/
    data_sensitivity:
      - technical
    metadata:
      tags:
        - 'Toolkit :: Blocklist Implementation'
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  mlbf_softblocks_source:
    <<: *mlbf_source
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859
      - https://bugzilla.mozilla.org/2018311/
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859#c2
      - https://bugzilla.mozilla.org/2018311/

  mlbf_generation_time: &mlbf_generation_time
    type: datetime
    description: >
      Keep track of the generation time of the addon
      blocklist's bloom filter. This marks the point
      in time until which signed add-ons are recognized
      by the selected bloom filter from the addons-bloomfilters
      collection.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1649960
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1689274
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466#c3
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
    data_sensitivity:
      - technical
    metadata:
      tags:
        - 'Toolkit :: Blocklist Implementation'
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  mlbf_softblocks_generation_time:
    <<: *mlbf_generation_time
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859#c2

  mlbf_stash_time_oldest:
    type: datetime
    description: >
      Keep track of the timestamp of the oldest stash
      of the addons blocklist.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1649960
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1689274
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466#c9
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
    data_sensitivity:
      - technical
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  mlbf_stash_time_newest:
    type: datetime
    description: >
      Keep track of the timestamp of the most recent
      stash of the addons blocklist.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1649960
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1689274
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1633466#c9
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
    data_sensitivity:
      - technical
    metadata:
      tags:
        - 'Toolkit :: Blocklist Implementation'
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  addon_block_change:
    type: event
    description: >
      An add-on is blocked, or an installed add-on is unblocked.
      When an add-on install/update is blocked, its installation
      is aborted and the add-on is no longer listed in the activeAddons
      field of TelemetryEnvironment.
    extra_keys:
      value:
        type: string
        description: >
          The value is the ID of the add-on.
      object:
        type: string
        description: >
          The object represents the reason for triggering
          the blocklistState check: "addon_install" is when
          an add-on is installed. "addon_update" is when an
          add-on is updated after an update check.
          "addon_update_check" is when an add-on is blocked
          during the update check. "addon_db_modified" is when
          an add-on's blocklistState was altered
          between application restarts. "blocklist_update"
          is when an add-on's blocklistState changed due to a
          blocklist update. This may be
          due to the blocklist being disabled by preferences
          or enterprise policies, but it is more commonly
          the result of updating entries in the blocklist.
          objects: ["addon_install", "addon_update",
          "addon_update_check", "addon_db_modified",
          "blocklist_update"]
      blocklist_state:
        type: string
        description: >
          The blocklistState of the add-on. 0 is unblocked,
          1 is soft blocked and 2 is hard blocked.
      addon_version:
        type: string
        description: >
          Version of the add-on. Used together with an
          add-on's ID (value) to identify add-ons to block.
      signed_date:
        type: string
        description: >
          Timestamp of the add-on (when it was signed via AMO).
          the add-on was installed or updated.
          At least zero when the blocklist is updated, -1 otherwise.
      hours_since:
        type: string
        description: >
          The number of hours that have passed since this version of
          This field is missing (0) for "addon_update_check".
      mlbf_last_time:
        type: string
        description: >
          The generation time of the most recent
          entry in the blocklist. Time generated by
          AMO when the blocklist entry was created.
          May be 0 when the blocklist is disabled.
      mlbf_generation:
        type: string
        description: >
          The generation time to identify the bloomfilter
          that was used for this blocklist decision.
          The bloomfilter is updated less frequently
          than the so-called stashes in the RemoteSettings
          collection that holds the blocklist data.
          The stashes take precedence over the bloomfilter
          in blocklist decisions.
          Time generated by AMO when the blocklist
          entry was created.
          May be 0 when the blocklist is disabled.
      mlbf_source:
        type: string
        description: >
          The source of the RemoteSettings attachment
          that holds the bloom filter. This field is
          documented in more detail in the definition
          of the blocklist.mlbf_source. Possible values
          are "dump_match", "cache_match",  "remote_match",
          "dump_fallback", "cache_fallback", "unknown".
      mlbf_softblocks_generation:
        type: string
        description: >
          Same as mlbf_generation but for the separate
          softblocks bloomfilter attachment.
      mlbf_softblocks_source:
        type: string
        description: >
          Same as mlbf_source but for the separate
          softblocks bloomfilter attachment.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662857
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1730037
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1763529
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1811159
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1820155
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662857#c11
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1861296#c5
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1912167#c4
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1917859#c2
    data_sensitivity:
      - technical
    metadata:
      tags:
        - 'Toolkit :: Blocklist Implementation'
    notification_emails:
      - addons-dev-internal@mozilla.com
      - rwu@mozilla.com
    expires: never

  enabled:
    type: boolean
    lifetime: application
    description: |
      Whether the extension blocklist is enabled.
      Corresponds to the `extensions.blocklist.enabled` pref.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1950389
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1950389
    data_sensitivity:
      - technical
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never

xpi.database:
  late_stack:
    type: text
    lifetime: application
    description: |
      Stack of XPI Database `saveChanges` call happening while the XPI provider
      is closing.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - stored_content

  sync_stack:
    type: text
    lifetime: application
    description: |
      Stack of XPI Database `syncLoadDB` call.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - stored_content

  late_load:
    type: text
    lifetime: application
    description: |
      Stack of XPI Database `asyncLoadDB` call happening while the XPI provider
      is closing.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - stored_content

  startup_load_reasons:
    type: string_list
    lifetime: application
    description: |
      List of reasons the XPI Database was updated.
      Examples include "appChanged", "directoryState".
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical

  startup_error:
    type: string
    lifetime: application
    description: |
      Reason for XPI Database startup error.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical

  parses:
    type: timing_distribution
    time_unit: millisecond
    lifetime: ping
    description: |
      How long it took to parse the XPI Database.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical

  rebuilds:
    type: labeled_timing_distribution
    time_unit: millisecond
    lifetime: ping
    description: |
      How long it took to rebuild the XPI Database
      per reason it was rebuilt.
      Previously reported in "main" ping `simpleMeasurements`.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1972836
    notification_emails:
      - addons-dev-internal@mozilla.com
    expires: never
    data_sensitivity:
      - technical
    labels:
      - XPIDB_rebuildReadFailed_MS
      - XPIDB_rebuildBadJSON_MS
      - XPIDB_rebuildUnreadableDB_MS
