Bug 1918702 - Migrate telemetry events to use Glean APIs for downloads.added, r=chutten.

Differential Revision: https://phabricator.services.mozilla.com/D222805
This commit is contained in:
Florian Quèze
2024-09-20 13:58:20 +00:00
parent efb98023f3
commit 44bfb6d0de
3 changed files with 39 additions and 16 deletions

View File

@@ -132,8 +132,6 @@ const FILE_EXTENSIONS = [
"zip",
];
const TELEMETRY_EVENT_CATEGORY = "downloads";
/**
* Represents a collection of Download objects that can be viewed and managed by
* the user interface, and persisted across sessions.
@@ -406,20 +404,7 @@ export class DownloadCombinedList extends DownloadList {
extension = "other";
}
try {
Services.telemetry.recordEvent(
TELEMETRY_EVENT_CATEGORY,
"added",
"fileExtension",
extension,
{}
);
} catch (ex) {
console.error(
"DownloadsCommon: error recording telemetry event.",
ex.message
);
}
Glean.downloads.addedFileExtension.record({ value: extension });
if (download.source.isPrivate) {
return this._privateList.add(download);

View File

@@ -0,0 +1,37 @@
# 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:
- 'Toolkit :: Downloads API'
downloads:
added_file_extension:
type: event
description: >
Sent when downloading a new file.
This event was generated to correspond to the Legacy Telemetry event
downloads.added#fileExtension.
bugs:
- https://bugzil.la/1627676
- https://bugzil.la/1706355
data_reviews:
- https://bugzil.la/1627676
- https://bugzil.la/1706355
notification_emails:
- rtestard@mozilla.com
- emalysz@mozilla.com
expires: never
extra_keys:
value:
description: >
Possible values are in contained in
DownloadList::kFileExtensions.
All other downloads not in the list are marked as other.
type: string
telemetry_mirror: Downloads_Added_Fileextension

View File

@@ -40,6 +40,7 @@ gecko_metrics = [
"security/manager/ssl/metrics.yaml",
"toolkit/components/antitracking/bouncetrackingprotection/metrics.yaml",
"toolkit/components/cookiebanners/metrics.yaml",
"toolkit/components/downloads/metrics.yaml",
"toolkit/components/extensions/metrics.yaml",
"toolkit/components/formautofill/metrics.yaml",
"toolkit/components/glean/metrics.yaml",