# 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 :: Normandy Client'

normandy:
  enroll_preference_study:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has
      succeeded.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enroll#preference_study.
    bugs: &normandy_enroll_bugs
      - https://bugzil.la/1443560
    data_reviews: &normandy_enroll_data_reviews
      - https://bugzil.la/1443560
    notification_emails: &normandy_enroll_emails
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys: &normandy_enroll_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      experimentType:
        description: >
          For preference_study and nimbus_experiment recipes, the type of experiment this is ("exp" or "exp-highpop").

        type: string
      branch:
        description: >
          The slug of the branch that was chosen for this client.

        type: string
      addonId:
        description: >
          For addon_study recipes, the ID of the addon that was installed.
        type: string
      addonVersion:
        description: >
          For addon_study recipes, the version of the addon that was installed.
        type: string
    telemetry_mirror: Normandy_Enroll_PreferenceStudy

  enroll_addon_study:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has
      succeeded.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enroll#addon_study.
    bugs: *normandy_enroll_bugs
    data_reviews: *normandy_enroll_data_reviews
    notification_emails: *normandy_enroll_emails
    expires: never
    extra_keys: *normandy_enroll_extra
    telemetry_mirror: Normandy_Enroll_AddonStudy

  enroll_preference_rollout:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has
      succeeded.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enroll#preference_rollout.
    bugs: *normandy_enroll_bugs
    data_reviews: *normandy_enroll_data_reviews
    notification_emails: *normandy_enroll_emails
    expires: never
    extra_keys: *normandy_enroll_extra
    telemetry_mirror: Normandy_Enroll_PreferenceRollout

  enroll_addon_rollout:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has
      succeeded.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enroll#addon_rollout.
    bugs: *normandy_enroll_bugs
    data_reviews: *normandy_enroll_data_reviews
    notification_emails: *normandy_enroll_emails
    expires: never
    extra_keys: *normandy_enroll_extra
    telemetry_mirror: Normandy_Enroll_AddonRollout

  enroll_nimbus_experiment:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has
      succeeded.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enroll#nimbus_experiment.
    bugs: *normandy_enroll_bugs
    data_reviews: *normandy_enroll_data_reviews
    notification_emails: *normandy_enroll_emails
    expires: never
    extra_keys: *normandy_enroll_extra
    telemetry_mirror: Normandy_Enroll_NimbusExperiment

  enroll_failed_addon_study:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enrollFailed#addon_study.
    bugs: &normandy_enrollFailed_bugs
      - https://bugzil.la/1443560
    data_reviews: &normandy_enrollFailed_data_reviews
      - https://bugzil.la/1443560
    notification_emails: &normandy_enrollFailed_emails
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys: &normandy_enrollFailed_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      reason:
        description: >
          An error code describing the failure.
        type: string
      preference:
        description: >
          For preference_rollout when reason=conflict, the name of the preference that was going to be modified.

        type: string
      detail:
        description: >
          For addon_study and branched_addon study, extra text describing the failure.

        type: string
      branch:
        description: >
          The branch that failed to enroll.

        type: string
      addonId:
        description: >
          The ID of the addon for the rollout when reason=conflict.
        type: string
      conflictingSlug:
        description: >
          The slug for the conflicting rollout.
        type: string
      enrollmentId:
        description: >
          The enrollment ID of the conflicting rollout.
        type: string
      prefBranch:
        description: >
          For preference_study when reason=invalid-branch, the branch that was invalid.
        type: string
    telemetry_mirror: Normandy_Enrollfailed_AddonStudy

  enroll_failed_preference_rollout:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enrollFailed#preference_rollout.
    bugs: *normandy_enrollFailed_bugs
    data_reviews: *normandy_enrollFailed_data_reviews
    notification_emails: *normandy_enrollFailed_emails
    expires: never
    extra_keys: *normandy_enrollFailed_extra
    telemetry_mirror: Normandy_Enrollfailed_PreferenceRollout

  enroll_failed_preference_study:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enrollFailed#preference_study.
    bugs: *normandy_enrollFailed_bugs
    data_reviews: *normandy_enrollFailed_data_reviews
    notification_emails: *normandy_enrollFailed_emails
    expires: never
    extra_keys: *normandy_enrollFailed_extra
    telemetry_mirror: Normandy_Enrollfailed_PreferenceStudy

  enroll_failed_addon_rollout:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enrollFailed#addon_rollout.
    bugs: *normandy_enrollFailed_bugs
    data_reviews: *normandy_enrollFailed_data_reviews
    notification_emails: *normandy_enrollFailed_emails
    expires: never
    extra_keys: *normandy_enrollFailed_extra
    telemetry_mirror: Normandy_Enrollfailed_AddonRollout

  enroll_failed_nimbus_experiment:
    type: event
    description: >
      Sent when applying a Normandy recipe of the above types has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.enrollFailed#nimbus_experiment.
    bugs: *normandy_enrollFailed_bugs
    data_reviews: *normandy_enrollFailed_data_reviews
    notification_emails: *normandy_enrollFailed_emails
    expires: never
    extra_keys: *normandy_enrollFailed_extra
    telemetry_mirror: Normandy_Enrollfailed_NimbusExperiment

  update_addon_study:
    type: event
    description: >
      This event is fired when a client detects that a recipe of the ahove
      types has changed on the server, and the new version of the recipe
      is being applied over an existing, older version previously fetched
      from the server.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.update#addon_study.
    bugs: &normandy_update_bugs
      - https://bugzil.la/1443560
      - https://bugzil.la/1474413
    data_reviews: &normandy_update_data_reviews
      - https://bugzil.la/1443560
      - https://bugzil.la/1474413
    notification_emails: &normandy_update_emails
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys: &normandy_update_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      previousState:
        description: >
          For preference_rollout recipes, the state of the rollout that had been applied previously.

        type: string
      addonId:
        description: >
          For addon_study recipes, the ID of the addon that was updated.
        type: string
      addonVersion:
        description: >
          For addon_study recipes, the version of the addon that was installed.
        type: string
      branch:
        description: >
          The branch that was updated.
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
    telemetry_mirror: Normandy_Update_AddonStudy

  update_preference_rollout:
    type: event
    description: >
      This event is fired when a client detects that a recipe of the ahove
      types has changed on the server, and the new version of the recipe
      is being applied over an existing, older version previously fetched
      from the server.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.update#preference_rollout.
    bugs: *normandy_update_bugs
    data_reviews: *normandy_update_data_reviews
    notification_emails: *normandy_update_emails
    expires: never
    extra_keys: *normandy_update_extra
    telemetry_mirror: Normandy_Update_PreferenceRollout

  update_addon_rollout:
    type: event
    description: >
      This event is fired when a client detects that a recipe of the ahove
      types has changed on the server, and the new version of the recipe
      is being applied over an existing, older version previously fetched
      from the server.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.update#addon_rollout.
    bugs: *normandy_update_bugs
    data_reviews: *normandy_update_data_reviews
    notification_emails: *normandy_update_emails
    expires: never
    extra_keys: *normandy_update_extra
    telemetry_mirror: Normandy_Update_AddonRollout

  update_nimbus_experiment:
    type: event
    description: >
      This event is fired when a client detects that a recipe of the ahove
      types has changed on the server, and the new version of the recipe
      is being applied over an existing, older version previously fetched
      from the server.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.update#nimbus_experiment.
    bugs: *normandy_update_bugs
    data_reviews: *normandy_update_data_reviews
    notification_emails: *normandy_update_emails
    expires: never
    extra_keys: *normandy_update_extra
    telemetry_mirror: Normandy_Update_NimbusExperiment

  update_failed_addon_study:
    type: event
    description: >
      Sent when applying a new version of a Normandy recipe of the above
      types (over an existing, older version previously fetched from the
      server) has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.updateFailed#addon_study.
    bugs: &normandy_updateFailed_bugs
      - https://bugzil.la/1474413
    data_reviews: &normandy_updateFailed_data_reviews
      - https://bugzil.la/1474413
    notification_emails: &normandy_updateFailed_emails
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys: &normandy_updateFailed_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      reason:
        description: >
          An error code describing the failure.
        type: string
      detail:
        description: >
          Extra text describing the failure. Currently only provided for addon_study.

        type: string
      branch:
        description: >
          The branch that failed to update.
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
    telemetry_mirror: Normandy_Updatefailed_AddonStudy

  update_failed_addon_rollout:
    type: event
    description: >
      Sent when applying a new version of a Normandy recipe of the above
      types (over an existing, older version previously fetched from the
      server) has failed.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.updateFailed#addon_rollout.
    bugs: *normandy_updateFailed_bugs
    data_reviews: *normandy_updateFailed_data_reviews
    notification_emails: *normandy_updateFailed_emails
    expires: never
    extra_keys: *normandy_updateFailed_extra
    telemetry_mirror: Normandy_Updatefailed_AddonRollout

  unenroll_preference_study:
    type: event
    description: >
      Sent when a Normandy recipe of certain types "ends".  N.B. For
      preference_rollback, this is fired when the recipe is fired (the
      recipe that "ends" is a corresponding preference_rollout).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenroll#preference_study.
    bugs: &normandy_unenroll_bugs
      - https://bugzil.la/1443560
      - https://bugzil.la/1843126
      - https://bugzil.la/1896718
      - https://bugzil.la/1907649
    data_reviews: &normandy_unenroll_data_reviews
      - https://bugzil.la/1443560
      - https://bugzil.la/1843126
      - https://bugzil.la/1896718
      - https://bugzil.la/1907649
    notification_emails: &normandy_unenroll_emails
      - normandy-notifications@mozilla.com
      - nimbus-team@mozilla.com
    expires: never
    extra_keys: &normandy_unenroll_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      reason:
        description: >
          A code describing the reason why the recipe ended.
        type: string
      didResetValue:
        description: >
          For preference_study, "true" or "false" according to whether we put the preference back the way it was.

        type: string
      addonId:
        description: >
          For addon_study, the ID of the addon that ended.
        type: string
      addonVersion:
        description: >
          For addon_study, the version of the addon for which the recipe ended.
        type: string
      branch:
        description: >
          The branch of the experiment that this client was on.
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
      changedPref:
        description: >
          For preference_study or nimbus_experiment, the preference that was detected to change that caused the unenrollment.

        type: string
      conflictingSlug:
        description: >
          For nimbus_experiment, if reason == "prefFlips-conflict", the conflicting experiment that caused the unenrollment.

        type: string
      prefName:
        description: >
          For nimbus_experiment, if reason == "prefFlips-failed", the name of the pref that failed to set.

        type: string
      prefType:
        description: >
          For nimbus_experiment, if reason = "prefFlips-failed", the type of the existing pref value (one of "bool", "string", "int", or "invalid").

        type: string
    telemetry_mirror: Normandy_Unenroll_PreferenceStudy

  unenroll_addon_study:
    type: event
    description: >
      Sent when a Normandy recipe of certain types "ends".  N.B. For
      preference_rollback, this is fired when the recipe is fired (the
      recipe that "ends" is a corresponding preference_rollout).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenroll#addon_study.
    bugs: *normandy_unenroll_bugs
    data_reviews: *normandy_unenroll_data_reviews
    notification_emails: *normandy_unenroll_emails
    expires: never
    extra_keys: *normandy_unenroll_extra
    telemetry_mirror: Normandy_Unenroll_AddonStudy

  unenroll_preference_rollback:
    type: event
    description: >
      Sent when a Normandy recipe of certain types "ends".  N.B. For
      preference_rollback, this is fired when the recipe is fired (the
      recipe that "ends" is a corresponding preference_rollout).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenroll#preference_rollback.
    bugs: *normandy_unenroll_bugs
    data_reviews: *normandy_unenroll_data_reviews
    notification_emails: *normandy_unenroll_emails
    expires: never
    extra_keys: *normandy_unenroll_extra
    telemetry_mirror: Normandy_Unenroll_PreferenceRollback

  unenroll_addon_rollback:
    type: event
    description: >
      Sent when a Normandy recipe of certain types "ends".  N.B. For
      preference_rollback, this is fired when the recipe is fired (the
      recipe that "ends" is a corresponding preference_rollout).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenroll#addon_rollback.
    bugs: *normandy_unenroll_bugs
    data_reviews: *normandy_unenroll_data_reviews
    notification_emails: *normandy_unenroll_emails
    expires: never
    extra_keys: *normandy_unenroll_extra
    telemetry_mirror: Normandy_Unenroll_AddonRollback

  unenroll_nimbus_experiment:
    type: event
    description: >
      Sent when a Normandy recipe of certain types "ends".  N.B. For
      preference_rollback, this is fired when the recipe is fired (the
      recipe that "ends" is a corresponding preference_rollout).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenroll#nimbus_experiment.
    bugs: *normandy_unenroll_bugs
    data_reviews: *normandy_unenroll_data_reviews
    notification_emails: *normandy_unenroll_emails
    expires: never
    extra_keys: *normandy_unenroll_extra
    telemetry_mirror: Normandy_Unenroll_NimbusExperiment

  unenroll_failed_preference_rollback:
    type: event
    description: >
      Sent when unenrolling a user fails (see the unenroll event).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenrollFailed#preference_rollback.
    bugs: &normandy_unenrollFailed_bugs
      - https://bugzil.la/1443560
      - https://bugzil.la/1693402
    data_reviews: &normandy_unenrollFailed_data_reviews
      - https://bugzil.la/1443560
      - https://bugzil.la/1693402
    notification_emails: &normandy_unenrollFailed_emails
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys: &normandy_unenrollFailed_extra
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      reason:
        description: >
          A code describing the reason the unenroll failed.
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
      changedPref:
        description: >
          For preference_study, the preference that was detected to change that caused the attempted unenrollment.
        type: string
      caller:
        description: >
          The function that caused the stop to happen, included on Nightly to aid debugging.
        type: string
      originalReason:
        description: >
          The code that would had been used for the unenrollment, had it not failed.
        type: string
    telemetry_mirror: Normandy_Unenrollfailed_PreferenceRollback

  unenroll_failed_preference_study:
    type: event
    description: >
      Sent when unenrolling a user fails (see the unenroll event).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenrollFailed#preference_study.
    bugs: *normandy_unenrollFailed_bugs
    data_reviews: *normandy_unenrollFailed_data_reviews
    notification_emails: *normandy_unenrollFailed_emails
    expires: never
    extra_keys: *normandy_unenrollFailed_extra
    telemetry_mirror: Normandy_Unenrollfailed_PreferenceStudy

  unenroll_failed_addon_rollback:
    type: event
    description: >
      Sent when unenrolling a user fails (see the unenroll event).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenrollFailed#addon_rollback.
    bugs: *normandy_unenrollFailed_bugs
    data_reviews: *normandy_unenrollFailed_data_reviews
    notification_emails: *normandy_unenrollFailed_emails
    expires: never
    extra_keys: *normandy_unenrollFailed_extra
    telemetry_mirror: Normandy_Unenrollfailed_AddonRollback

  unenroll_failed_nimbus_experiment:
    type: event
    description: >
      Sent when unenrolling a user fails (see the unenroll event).
      This event was generated to correspond to the Legacy Telemetry event
      normandy.unenrollFailed#nimbus_experiment.
    bugs: *normandy_unenrollFailed_bugs
    data_reviews: *normandy_unenrollFailed_data_reviews
    notification_emails: *normandy_unenrollFailed_emails
    expires: never
    extra_keys: *normandy_unenrollFailed_extra
    telemetry_mirror: Normandy_Unenrollfailed_NimbusExperiment

  graduate_preference_rollout:
    type: event
    description: >
      Sent when a preference rollout ends due to the rolled-out preference
      becoming a new default.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.graduate#preference_rollout.
    bugs:
      - https://bugzil.la/1443560
    data_reviews:
      - https://bugzil.la/1443560
    notification_emails:
      - normandy-notifications@mozilla.com
    expires: never
    extra_keys:
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
      reason:
        description: >
          The reason the rollout graduated
        type: string
    telemetry_mirror: Normandy_Graduate_PreferenceRollout

  exp_pref_changed_preference_study:
    type: event
    description: >
      This records that a preference that was set by an experiment has
      been changed away from its experimental value. This can be triggered
      by a user changing a preference at runtime, by the preference being
      changed on disk when Firefox is not running, or by the preference
      already having a user-set value when a user has enrolls in a default
      branch experiment.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.expPrefChanged#preference_study.
    bugs:
      - https://bugzil.la/1698684
    data_reviews:
      - https://bugzil.la/1698684
    notification_emails:
      - mcooper@mozilla.com
    expires: never
    extra_keys:
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      preferenceName:
        description: >
          The preference that changed
        type: string
      reason:
        description: >
          The way that the preference change was detected ("observer", "sideload", or "onEnroll")
        type: string
      enrollmentId:
        description: >
          A unique ID for this enrollment that will be included in all related Telemetry.
        type: string
    telemetry_mirror: Normandy_Expprefchanged_PreferenceStudy

  validation_failed_nimbus_experiment:
    type: event
    description: >
      This records when validation of a recipe fails.
      This event was generated to correspond to the Legacy Telemetry event
      normandy.validationFailed#nimbus_experiment.
    bugs:
      - https://bugzil.la/1762652
    data_reviews:
      - https://bugzil.la/1762652
    notification_emails:
      - beth@mozilla.com
    expires: never
    extra_keys:
      value:
        description: >
          The `value` of the event. Mirrors to the Legacy Telemetry
          event's `value` parameter.
        type: string
      reason:
        description: >
          Why validation failed (one of "invalid-recipe", "invalid-branch", or "invalid-reason").
        type: string
      branch:
        description: >
          If reason == invalid-branch, the branch that failed validation.
        type: string
      feature:
        description: >
          If reason == invalid-feature, the invalid feature ID.
        type: string
      locale:
        description: >
          If reason == missing-locale, the locale that was missing from the localization table. If reason == missing-l10n-entry, the locale that was missing the localization entries.

        type: string
      l10n_ids:
        description: >
          If reason == missing-l10n-entry, a comma-separated list of missing localization entries.

        type: string
    telemetry_mirror: Normandy_Validationfailed_NimbusExperiment

  recipe_freshness:
    type: labeled_quantity
    description: >
      For each recipe ID seen by the Normandy client, its last_modified.
      This metric was generated to correspond to the Legacy Telemetry
      scalar normandy.recipe_freshness.
    bugs:
      - https://bugzil.la/1530508
    data_reviews:
      - https://bugzil.la/1530508
    notification_emails:
      - product-delivery@mozilla.com
    expires: never
    unit: revision id
    telemetry_mirror: NORMANDY_RECIPE_FRESHNESS
