# 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/.

# This file defines the metrics that will be gathered for the "places"
# storage component.
# These are emitted for all users of the component.  Additional metrics
# specific to the *syncing* of places are defined in a separate "sync_ping"
# package.
#
# Changes to these metrics require data review, which should take into
# consideration
# the following known consumers of the places component Android bindings:
#
#  * Fenix for Android

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0

places_manager:
  run_maintenance_time:
    type: timing_distribution
    description: Time taken to execute `run_maintenance()`
    time_unit: millisecond
    bugs:
      - https://github.com/mozilla/application-services/issues/5115
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5122
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical

  run_maintenance_prune_time:
    type: timing_distribution
    description: Time taken to execute `prune_older_visits()` inside
      `run_maintenance()`
    time_unit: millisecond
    bugs:
      - https://github.com/mozilla/application-services/issues/5246
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5247
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical

  run_maintenance_vacuum_time:
    type: timing_distribution
    description: Time taken to execute `VACUUM` inside `run_maintenance()`
    time_unit: millisecond
    bugs:
      - https://github.com/mozilla/application-services/issues/5246
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5247
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical

  run_maintenance_optimize_time:
    type: timing_distribution
    description: Time taken to execute `PRAGMA optimize` inside
      `run_maintenance()`
    time_unit: millisecond
    bugs:
      - https://github.com/mozilla/application-services/issues/5246
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5247
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical

  run_maintenance_chk_pnt_time:
    type: timing_distribution
    description: Time taken to execute `PRAGMA_CHECKPOINT` inside
      `run_maintenance()`
    time_unit: millisecond
    bugs:
      - https://github.com/mozilla/application-services/issues/5246
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5247
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical

  db_size_after_maintenance:
    type: memory_distribution
    description: >
      Size of the db after executing `run_maintenance()`
    memory_unit: kilobyte
    bugs:
      - https://github.com/mozilla/application-services/issues/5115
    data_reviews:
      - https://github.com/mozilla/application-services/issues/5122
      - https://github.com/mozilla/application-services/issues/5387
      - https://github.com/mozilla/application-services/issues/5830
    notification_emails:
      - synced-client-integrations@mozilla.com
      - bdk@mozilla.com
    expires: "never"
    data_sensitivity:
      - technical
