Close #22956: Define "tags" for metrics in the app repository

Co-authored-by: William Lachance <wlach@protonmail.com>

Define "tags" for metrics in the app repository

Using the new "tags" feature in Glean, we can remove most of the
manual process/pain of defining tags in a seperate Glean annotations
repository (see: https://github.com/mozilla-mobile/fenix/wiki/Add-a-Glean-Annotation-for-an-event)
and just put them beside the metrics themselves. This should make it
much easier to keep this metadata up to date, since it can be added
in the same pull request as the instrumentation itself.

To keep the list of tags up to date with the Fenix issue labels, a new
script `update-glean-tags.py` has been added to the repository. It
should not need to be run often.

This pull request uses a scraped version of the defined tags in the
Glean annotations repository. After it lands, we can remove those and
just use the tagging information here as the main source of information.
This commit is contained in:
Roger Yang 2022-01-18 14:45:10 -05:00 committed by mergify[bot]
parent 268ba9b39d
commit af5b2c94d3
3 changed files with 1012 additions and 4 deletions

File diff suppressed because it is too large Load Diff

214
app/tags.yaml Normal file
View File

@ -0,0 +1,214 @@
# 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 was AUTOMATICALLY GENERATED by `./tools/update-glean-tags.py`
### DO NOT edit it by hand.
# Disable line-length rule because the links in the descriptions can be long
# yamllint disable rule:line-length
---
$schema: moz://mozilla.org/schemas/glean/tags/1-0-0
Accounts:
description: Corresponds to the [Feature:Accounts](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AAccounts)
label on GitHub.
AndroidIntegration:
description: Corresponds to the [Feature:AndroidIntegration](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AAndroidIntegration)
label on GitHub.
Autofill:
description: Address and Credit Card autofill. Corresponds to the [Feature:Autofill](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AAutofill)
label on GitHub.
Battery:
description: Corresponds to the [Feature:Battery](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ABattery)
label on GitHub.
Bookmarks:
description: Corresponds to the [Feature:Bookmarks](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ABookmarks)
label on GitHub.
Browsing:
description: Issues related to browsing experience, browser navigation, not web
issues. Corresponds to the [Feature:Browsing](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ABrowsing)
label on GitHub.
China:
description: Corresponds to the [Feature:China](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AChina)
label on GitHub.
Collections:
description: Corresponds to the [Feature:Collections](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ACollections)
label on GitHub.
ContextMenu:
description: Menu that appears when long-pressing on website content. Corresponds
to the [Feature:ContextMenu](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AContextMenu)
label on GitHub.
CrashReporting:
description: Corresponds to the [Feature:CrashReporting](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ACrashReporting)
label on GitHub.
CustomTabs:
description: Corresponds to the [Feature:CustomTabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ACustomTabs)
label on GitHub.
Discovery:
description: Corresponds to the [Feature:Discovery](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ADiscovery)
label on GitHub.
Download:
description: Corresponds to the [Feature:Download](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ADownload)
label on GitHub.
ErrorMessages:
description: Corresponds to the [Feature:ErrorMessages](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AErrorMessages)
label on GitHub.
Experiments:
description: A category for experiment-related features.. Corresponds to the [Feature:Experiments](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AExperiments)
label on GitHub.
FennecTransition:
description: Corresponds to the [Feature:FennecTransition](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AFennecTransition)
label on GitHub.
FindBar:
description: Corresponds to the [Feature:FindBar](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AFindBar)
label on GitHub.
Forms:
description: Corresponds to the [Feature:Forms](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AForms)
label on GitHub.
Gesture:
description: Corresponds to the [Feature:Gesture](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AGesture)
label on GitHub.
History:
description: Corresponds to the [Feature:History](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AHistory)
label on GitHub.
HomeScreen:
description: Corresponds to the [Feature:HomeScreen](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AHomeScreen)
label on GitHub.
IME:
description: Text entry and keyboards. Corresponds to the [Feature:IME](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AIME)
label on GitHub.
InactiveTabs:
description: Tabs in the tabs tray that have not been used in some time.. Corresponds
to the [Feature:InactiveTabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AInactiveTabs)
label on GitHub.
Logins:
description: Corresponds to the [Feature:Logins](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ALogins)
label on GitHub.
MainMenu:
description: The three-dot menu that is seen on the browser and homescreen.. Corresponds
to the [Feature:MainMenu](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AMainMenu)
label on GitHub.
Media:
description: Corresponds to the [Feature:Media](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AMedia)
label on GitHub.
Migration:
description: Corresponds to the [Feature:Migration](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AMigration)
label on GitHub.
Notifications:
description: Corresponds to the [Feature:Notifications](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ANotifications)
label on GitHub.
Offline:
description: Corresponds to the [Feature:Offline](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AOffline)
label on GitHub.
Onboarding:
description: First Run, Contextual Feature Recommendation/Recommender CFR. Corresponds
to the [Feature:Onboarding](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AOnboarding)
label on GitHub.
OpenInApp:
description: intents. Corresponds to the [Feature:OpenInApp](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AOpenInApp)
label on GitHub.
PWA:
description: Progressive Web App. Corresponds to the [Feature:PWA](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APWA)
label on GitHub.
Performance:
description: Used for data reviews to label metrics related to performance. Corresponds
to the [Feature:Performance](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APerformance)
label on GitHub.
PocketIntegration:
description: Corresponds to the [Feature:PocketIntegration](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APocketIntegration)
label on GitHub.
Privacy&Security:
description: Corresponds to the [Feature:Privacy&Security](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APrivacy%26Security)
label on GitHub.
PrivateBrowsing:
description: Corresponds to the [Feature:PrivateBrowsing](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APrivateBrowsing)
label on GitHub.
Push:
description: WebPush or Marketing push related features.. Corresponds to the [Feature:Push](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3APush)
label on GitHub.
QRCode:
description: Corresponds to the [Feature:QRCode](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AQRCode)
label on GitHub.
QuickSettings:
description: Corresponds to the [Feature:QuickSettings](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AQuickSettings)
label on GitHub.
ReaderMode:
description: Corresponds to the [Feature:ReaderMode](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AReaderMode)
label on GitHub.
RecentTabs:
description: Recent tabs on the homescreen. Corresponds to the [Feature:RecentTabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ARecentTabs)
label on GitHub.
RequestDesktopSite:
description: Corresponds to the [Feature:RequestDesktopSite](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ARequestDesktopSite)
label on GitHub.
Search:
description: Corresponds to the [Feature:Search](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASearch)
label on GitHub.
SearchGroupHistory:
description: Search term groups on History view. Corresponds to the [Feature:SearchGroupHistory](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASearchGroupHistory)
label on GitHub.
SearchProvider:
description: Corresponds to the [Feature:SearchProvider](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASearchProvider)
label on GitHub.
SearchTermTabs:
description: Tabs in the tabs tray that have the same search term.. Corresponds
to the [Feature:SearchTermTabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASearchTermTabs)
label on GitHub.
SendTab:
description: Corresponds to the [Feature:SendTab](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASendTab)
label on GitHub.
Settings:
description: Corresponds to the [Feature:Settings](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASettings)
label on GitHub.
Sharing:
description: Corresponds to the [Feature:Sharing](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASharing)
label on GitHub.
Shortcuts:
description: bookmarks on the Android homescreen. Corresponds to the [Feature:Shortcuts](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AShortcuts)
label on GitHub.
SitePermissions:
description: Corresponds to the [Feature:SitePermissions](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASitePermissions)
label on GitHub.
Snackbar:
description: Corresponds to the [Feature:Snackbar](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASnackbar)
label on GitHub.
Sync:
description: Corresponds to the [Feature:Sync](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASync)
label on GitHub.
SyncTabs:
description: Sync tabs. Corresponds to the [Feature:SyncTabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ASyncTabs)
label on GitHub.
Tabs:
description: Corresponds to the [Feature:Tabs](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ATabs)
label on GitHub.
Telemetry:
description: Corresponds to the [Feature:Telemetry](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ATelemetry)
label on GitHub.
TextSelection:
description: Corresponds to the [Feature:TextSelection](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ATextSelection)
label on GitHub.
Themes:
description: Dark mode, light mode, private browsing mode. Corresponds to the
[Feature:Themes](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AThemes)
label on GitHub.
Toolbar:
description: Address bar, see also Feature:Search. Corresponds to the [Feature:Toolbar](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AToolbar)
label on GitHub.
TopSites:
description: Corresponds to the [Feature:TopSites](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ATopSites)
label on GitHub.
TrackingProtection:
description: Corresponds to the [Feature:TrackingProtection](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3ATrackingProtection)
label on GitHub.
Voice:
description: Corresponds to the [Feature:Voice](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AVoice)
label on GitHub.
WebAuthn:
description: Feature work pertaining to WebAuthn. Corresponds to the [Feature:WebAuthn](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AWebAuthn)
label on GitHub.
WebExtensions:
description: Corresponds to the [Feature:WebExtensions](https://github.com/mozilla-mobile/fenix/issues?q=label%3AFeature%3AWebExtensions)
label on GitHub.

59
tools/update-glean-tags.py Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""
Scrapes GitHub labels for Fenix and generates a set of glean tags for use in metrics
See https://mozilla.github.io/glean/book/reference/yaml/tags.html
"""
import urllib
from pathlib import Path
import requests
import yaml
LICENSE_HEADER = """# 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/.
"""
GENERATED_HEADER = """
### This file was AUTOMATICALLY GENERATED by `./tools/update-glean-tags.py`
### DO NOT edit it by hand.
# Disable line-length rule because the links in the descriptions can be long
# yamllint disable rule:line-length
"""
TAGS_FILENAME = (Path(__file__).parent / "../app/tags.yaml").resolve()
labels = []
page = 1
while True:
more_labels = requests.get(
f"https://api.github.com/repos/mozilla-mobile/fenix/labels?per_page=100&page={page}"
).json()
if not more_labels:
break
labels += more_labels
page += 1
tags = {"$schema": "moz://mozilla.org/schemas/glean/tags/1-0-0"}
for label in labels:
if label["name"].startswith("Feature:"):
abbreviated_label = label["name"].replace("Feature:", "")
url = (
"https://github.com/mozilla-mobile/fenix/issues?q="
+ urllib.parse.quote_plus(f"label:{label['name']}")
)
label_description = (
(label["description"].strip() + ". ") if len(label["description"]) else ""
)
tags[abbreviated_label] = {
"description": f"{label_description}Corresponds to the [{label['name']}]({url}) label on GitHub."
}
open(TAGS_FILENAME, "w").write(
"{}\n{}\n\n".format(LICENSE_HEADER, GENERATED_HEADER)
+ yaml.dump(tags, width=78, explicit_start=True)
)