From 589bf8c6d548fbe5eb5a021cdc11c26fde9b5313 Mon Sep 17 00:00:00 2001 From: Robert Helmer Date: Thu, 27 Jun 2024 10:37:07 -0700 Subject: [PATCH] MNTOR-3096 - add monitor glean backend (#4544) * add backend metrics yaml for Glean --------- Co-authored-by: Sean Rose <1994030+sean-rose@users.noreply.github.com> --- .github/workflows/glean-probe-scraper.yml | 8 +- docs/telemetry/backend/metrics.md | 39 ++++ docs/{ => telemetry/frontend}/metrics.md | 5 +- package.json | 4 +- src/telemetry/backend-metrics.yaml | 212 ++++++++++++++++++++++ 5 files changed, 262 insertions(+), 6 deletions(-) create mode 100644 docs/telemetry/backend/metrics.md rename docs/{ => telemetry/frontend}/metrics.md (93%) create mode 100644 src/telemetry/backend-metrics.yaml diff --git a/.github/workflows/glean-probe-scraper.yml b/.github/workflows/glean-probe-scraper.yml index a58c1f510c0..47f97fd430e 100644 --- a/.github/workflows/glean-probe-scraper.yml +++ b/.github/workflows/glean-probe-scraper.yml @@ -2,10 +2,12 @@ name: Glean probe-scraper on: push: paths: - - src/telemetry/metrics.yml + - src/telemetry/metrics.yaml + - src/telemetry/backend-metrics.yaml pull_request: paths: - - src/telemetry/metrics.yml + - src/telemetry/metrics.yaml + - src/telemetry/backend-metrics.yaml jobs: glean-probe-scraper: - uses: mozilla/probe-scraper/.github/workflows/glean.yaml@main + uses: mozilla/probe-scraper/.github/workflows/glean.yaml@main \ No newline at end of file diff --git a/docs/telemetry/backend/metrics.md b/docs/telemetry/backend/metrics.md new file mode 100644 index 00000000000..2b0e4a1d150 --- /dev/null +++ b/docs/telemetry/backend/metrics.md @@ -0,0 +1,39 @@ + + +# Metrics + +This document enumerates the metrics collected by this project using the [Glean SDK](https://mozilla.github.io/glean/book/index.html). +This project may depend on other projects which also collect metrics. +This means you might have to go searching through the dependency tree to get a full picture of everything collected by this project. + +# Pings + +- [events](#events) + +## events + +This is a built-in ping that is assembled out of the box by the Glean SDK. + +See the Glean SDK documentation for the [`events` ping](https://mozilla.github.io/glean/book/user/pings/events.html). + +All Glean pings contain built-in metrics in the [`ping_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-ping_info-section) and [`client_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section) sections. + +In addition to those built-in metrics, the following metrics are added to the ping: + +| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) | +| ----------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------- | +| account.create | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A new Mozilla Monitor account has been created. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| account.password_change | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | The password for an existing Mozilla Account has been changed, and existing auth tokens have been revoked. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| account.profile_change | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | An existing Mozilla Accounts profile has been changed, for example the primary email address. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| account.remove | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | An existing Mozilla Monitor account has been deleted. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| monitor.plan_tier | [string](https://mozilla.github.io/glean/book/user/metrics/string.html) | Which tier of plan the user is on [Free, Plus] | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| monitor.session_id | [string](https://mozilla.github.io/glean/book/user/metrics/string.html) | An ID that allows us to track “sessions” of the user experience within the product. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| monitor.user_id | [string](https://mozilla.github.io/glean/book/user/metrics/string.html) | Mozilla Monitor-specific user ID. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| mozilla.account_id | [string](https://mozilla.github.io/glean/book/user/metrics/string.html) | Mozilla Accounts ID. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| page.view | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A web page view event distinguishable by the page’s URL. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| subscription.activate | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A subscription has been activated for this user. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | +| subscription.cancel | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A subscription cancellation has taken effect, and the user is no longer subscribed to Monitor Plus. | [Bug 1896222](https://bugzilla.mozilla.org/show_bug.cgi?id=1896222) | | never | 2 | + +Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). + + diff --git a/docs/metrics.md b/docs/telemetry/frontend/metrics.md similarity index 93% rename from docs/metrics.md rename to docs/telemetry/frontend/metrics.md index ca37ffe72a9..8fa4078f672 100644 --- a/docs/metrics.md +++ b/docs/telemetry/frontend/metrics.md @@ -1,4 +1,4 @@ - + # Metrics @@ -24,6 +24,7 @@ In addition to those built-in metrics, the following metrics are added to the pi | ---------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | -------------------------------------------------------------------- | | button.click | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A click on a button that doesn’t fall into one of the two other button categories (call-to-action (CTA) or purchase intent). | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | | collapse.click | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A click to collapse a section on the webpage. | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | +| csat_survey.click | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A click on a CSAT survey response button. | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | | cta_button.click | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A click on a button that has a specific call-to-action. | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | | dashboard.view | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A view event of a Monitor user’s dashboard, where a user is able to view their data breaches and broker information. | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | | expand.click | [event](https://mozilla.github.io/glean/book/user/metrics/event.html) | A click to expand a section of the webpage. | [Bug 1823766](https://bugzilla.mozilla.org/show_bug.cgi?id=1823766) | | never | 2 | @@ -37,4 +38,4 @@ In addition to those built-in metrics, the following metrics are added to the pi Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). - + diff --git a/package.json b/package.json index 50cee705b58..5a411efe3c7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,9 @@ "build-nimbus": "node src/scripts/build/nimbusTypes.js", "build-glean": "glean translate src/telemetry/metrics.yaml --format typescript --output src/telemetry/generated && npm run build-glean-types", "build-glean-types": "node src/scripts/build/gleanTypes.js", - "build-glean-docs": "glean translate src/telemetry/metrics.yaml --format markdown --output docs" + "build-glean-docs": "npm run build-glean-frontend-docs && npm run build-glean-backend-docs", + "build-glean-frontend-docs": "glean translate src/telemetry/metrics.yaml --format markdown --output docs/telemetry/frontent", + "build-glean-backend-docs": "glean translate src/telemetry/backend-metrics.yaml --format markdown --output docs/telemetry/backend" }, "repository": { "type": "git", diff --git a/src/telemetry/backend-metrics.yaml b/src/telemetry/backend-metrics.yaml new file mode 100644 index 00000000000..04c65340117 --- /dev/null +++ b/src/telemetry/backend-metrics.yaml @@ -0,0 +1,212 @@ +# 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 + +--- +$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 + +mozilla: + account_id: + description: Mozilla Accounts ID. + type: string + lifetime: application + send_in_pings: + - events + notification_emails: + - rhelmer@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + expires: never + data_sensitivity: + - interaction + +monitor: + session_id: + description: An ID that allows us to track “sessions” of the user experience within the product. + type: string + lifetime: application + send_in_pings: + - events + notification_emails: + - rhelmer@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + expires: never + data_sensitivity: + - interaction + + user_id: + description: Mozilla Monitor-specific user ID. + type: string + lifetime: application + send_in_pings: + - events + notification_emails: + - rhelmer@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + expires: never + data_sensitivity: + - interaction + + plan_tier: + description: Which tier of plan the user is on [Free, Plus] + type: string + lifetime: application + send_in_pings: + - events + notification_emails: + - rhelmer@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + expires: never + data_sensitivity: + - interaction + +page: + view: + type: event + description: | + A web page view event distinguishable by the page’s URL. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + extra_keys: + path: + description: The path of the page. + type: string + utm_campaign: + description: Attribution campaign. + type: string + utm_content: + description: Attribution content. + type: string + utm_medium: + description: Attribution medium. + type: string + utm_source: + description: Attribution source. + type: string + utm_term: + description: Attribution term. + type: string + referrer: + description: The referring URL, if any. + type: string + +subscription: + activate: + type: event + description: | + A subscription has been activated for this user. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + + cancel: + type: event + description: | + A subscription cancellation has taken effect, and the user is no longer subscribed to Monitor Plus. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + +account: + create: + type: event + description: | + A new Mozilla Monitor account has been created. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + + remove: + type: event + description: | + An existing Mozilla Monitor account has been deleted. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + + profile_change: + type: event + description: | + An existing Mozilla Accounts profile has been changed, for example the primary email address. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events + + password_change: + type: event + description: | + The password for an existing Mozilla Account has been changed, and existing auth tokens have been revoked. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1896222 + data_sensitivity: + - interaction + notification_emails: + - rhelmer@mozilla.com + expires: never + send_in_pings: + - events