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

# For more information on configuring this file:
# https://mozilla.github.io/glean/book/reference/yaml/metrics.html

# This file is also used to generate privaterelay/glean/server_events.py
# which is used to generate the Glean pings-as-logs. See that file for the
# re-generation command.
---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0

email_mask:
  deleted:
    type: event
    description: A Relay user deletes an email mask.
    expires: never
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
      - https://mozilla-hub.atlassian.net/browse/MPP-3352
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys: &default_mask_extra_keys
      fxa_id:
        description: Mozilla accounts user ID
        type: string
      platform:
        description: Relay client platform
        type: string
      n_random_masks:
        description: Number of random masks
        type: quantity
      n_domain_masks:
        description: Number of premium subdomain masks
        type: quantity
      n_deleted_random_masks:
        description: Number of deleted random masks
        type: quantity
      n_deleted_domain_masks:
        description: Number of deleted domain masks
        type: quantity
      date_joined_relay:
        description: Timestamp for joining Relay, seconds since epoch
        type: quantity
      premium_status:
        description: Subscription type and term
        type: string
      date_joined_premium:
        description: Timestamp for starting premium_status subscription, seconds since epoch, -1 if not subscribed
        type: quantity
      has_extension:
        description: The user has the Relay Add-on
        type: boolean
      date_got_extension:
        description: Timestamp for adding Relay Add-on, seconds since epoch, -1 if not used
        type: quantity
      is_random_mask:
        description: The mask is a random mask, instead of a domain mask
        type: boolean
  created:
    type: event
    description: A Relay user creates an email mask.
    expires: never
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
      - https://mozilla-hub.atlassian.net/browse/MPP-3352
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys:
      <<: *default_mask_extra_keys
      created_by_api:
        description: The mask was created via the API, rather than an incoming email
        type: boolean
      has_website:
        description: The mask was created by the Add-on or integration on a website
        type: boolean
  label_updated:
    type: event
    description: A Relay user updates an email mask's label.
    expires: never
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
      - https://mozilla-hub.atlassian.net/browse/MPP-3352
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys: *default_mask_extra_keys

email:
  forwarded:
    type: event
    description: Relay receives and forwards an email for a Relay user.
    expires: never
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
      - https://mozilla-hub.atlassian.net/browse/MPP-3352
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys: &default_email_extra_keys
      <<: *default_mask_extra_keys
      is_reply:
        description: The email is a reply from the Relay user
        type: boolean
  blocked:
    type: event
    description: Relay receives but does not forward an email for a Relay user.
    expires: never
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
      - https://mozilla-hub.atlassian.net/browse/MPP-3352
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882565
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys:
      <<: *default_email_extra_keys
      reason:
        description: Code describing why the email was blocked
        type: string

api:
  accessed:
    type: event
    description: An API endpoint was accessed.
    expires: never
    data_reviews:
      - https://github.com/mozilla/fx-private-relay/pull/5500
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    bugs:
      - https://mozilla-hub.atlassian.net/browse/MPP-4012
    extra_keys:
      endpoint:
        description: The name of the endpoint accessed
        type: string
      method:
        description: HTTP method used
        type: string
      fxa_id:
        description: Mozilla accounts user ID
        type: string

phone:
  text_received:
    type: event
    description: A Relay user receives a text message.
    expires: never
    bugs:
      - https://mozilla-hub.atlassian.net/browse/MPP-4014
    data_reviews:
      - https://github.com/mozilla/fx-private-relay/pull/5500
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys:
      fxa_id:
        description: Mozilla accounts user ID
        type: string

  call_received:
    type: event
    description: A Relay user receives a phone call.
    expires: never
    bugs:
      - https://mozilla-hub.atlassian.net/browse/MPP-4014
    data_reviews:
      - https://github.com/mozilla/fx-private-relay/pull/5500
    notification_emails:
      - lcrouch@mozilla.com
      - relay-team@mozilla.com
    data_sensitivity:
      - interaction
    extra_keys:
      fxa_id:
        description: Mozilla accounts user ID
        type: string
