Skip to content

Commit

Permalink
chore(telemetry): renew metrics (and remove some) (#11724)
Browse files Browse the repository at this point in the history
dropping: userAgent, viewportRatio and viewportHorizontalCoverage
renew: everything else
  • Loading branch information
fiji-flo authored Sep 3, 2024
1 parent 46e9a9f commit 852d867
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 129 deletions.
2 changes: 1 addition & 1 deletion client/src/telemetry/generated/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// AUTOGENERATED BY glean_parser v14.0.1. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from "@mozilla/glean/private/metrics/event";

Expand Down
43 changes: 1 addition & 42 deletions client/src/telemetry/generated/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
* 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/. */

// AUTOGENERATED BY glean_parser v14.0.1. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import StringListMetricType from "@mozilla/glean/private/metrics/string_list";
import QuantityMetricType from "@mozilla/glean/private/metrics/quantity";
import StringMetricType from "@mozilla/glean/private/metrics/string";

/**
Expand Down Expand Up @@ -48,19 +47,6 @@ export const subscriptionType = new StringMetricType({
disabled: false,
});

/**
* The navigators user agent.
*
* Generated from `navigator.user_agent`.
*/
export const userAgent = new StringMetricType({
category: "navigator",
name: "user_agent",
sendInPings: ["action", "page"],
lifetime: "application",
disabled: false,
});

/**
* The user's preferred languages.
*
Expand All @@ -87,30 +73,3 @@ export const viewportBreakpoint = new StringMetricType({
lifetime: "application",
disabled: false,
});

/**
* The ratio of viewport width to screen width, expressed as a percentage.
*
* Generated from `navigator.viewport_horizontal_coverage`.
*/
export const viewportHorizontalCoverage = new QuantityMetricType({
category: "navigator",
name: "viewport_horizontal_coverage",
sendInPings: ["action", "page"],
lifetime: "application",
disabled: false,
});

/**
* The ratio of viewport width to viewport height,
* expressed as a percentage.
*
* Generated from `navigator.viewport_ratio`.
*/
export const viewportRatio = new QuantityMetricType({
category: "navigator",
name: "viewport_ratio",
sendInPings: ["action", "page"],
lifetime: "application",
disabled: false,
});
2 changes: 1 addition & 1 deletion client/src/telemetry/generated/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// AUTOGENERATED BY glean_parser v14.0.1. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import LabeledMetricType from "@mozilla/glean/private/metrics/labeled";
import UrlMetricType from "@mozilla/glean/private/metrics/url";
Expand Down
2 changes: 1 addition & 1 deletion client/src/telemetry/generated/pings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// AUTOGENERATED BY glean_parser v14.0.1. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import PingType from "@mozilla/glean/private/ping";

Expand Down
19 changes: 0 additions & 19 deletions client/src/telemetry/glean-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ export type PageProps = {
subscriptionType: string;
geo: string | undefined;
geo_iso: string | undefined;
userAgent: string | undefined;
userLanguages: string[];
viewportBreakpoint: ViewportBreakpoint | undefined;
viewportRatio: number;
viewportHorizontalCoverage: number;
isBaseline?: string;
utm: UTMParameters;
};
Expand Down Expand Up @@ -127,23 +124,12 @@ function glean(): GleanAnalytics {
if (page.geo_iso) {
navigatorMetric.geoIso.set(page.geo_iso);
}
if (page.userAgent) {
navigatorMetric.userAgent.set(page.userAgent);
}
if (page.userLanguages) {
navigatorMetric.userLanguages.set(page.userLanguages);
}
if (page.viewportBreakpoint) {
navigatorMetric.viewportBreakpoint.set(page.viewportBreakpoint);
}
if (page.viewportRatio) {
navigatorMetric.viewportRatio.set(page.viewportRatio);
}
if (page.viewportHorizontalCoverage) {
navigatorMetric.viewportHorizontalCoverage.set(
page.viewportHorizontalCoverage
);
}
navigatorMetric.subscriptionType.set(page.subscriptionType);
return () => pings.page.submit();
},
Expand Down Expand Up @@ -215,18 +201,13 @@ export function useGleanPage(pageNotFound: boolean, doc?: Doc) {
referrer: document?.referrer,
// on port 3000 this will always return "200":
httpStatus: pageNotFound ? "404" : "200",
userAgent: navigator?.userAgent,
userLanguages: Array.from(navigator?.languages || []),
geo: userData?.geo?.country,
geo_iso: userData?.geo?.country_iso,
subscriptionType: userData?.subscriptionType || "anonymous",
viewportBreakpoint: VIEWPORT_BREAKPOINTS.find(
([_, width]) => width <= window.innerWidth
)?.[0],
viewportRatio: Math.round((100 * window.innerWidth) / window.innerHeight),
viewportHorizontalCoverage: Math.round(
(100 * window.innerWidth) / window.screen.width
),
isBaseline: doc?.baseline?.baseline
? `baseline_${doc.baseline.baseline}`
: doc?.baseline?.baseline === false
Expand Down
76 changes: 11 additions & 65 deletions client/src/telemetry/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ page:
- https://github.com/mdn/yari/pull/6813#issuecomment-1203705308
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
referrer:
type: url
lifetime: application
Expand All @@ -36,7 +36,7 @@ page:
- https://github.com/mdn/yari/pull/6813#issuecomment-1203705308
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
utm:
type: labeled_string
lifetime: application
Expand All @@ -58,7 +58,7 @@ page:
- "https://bugzilla.mozilla.org/show_bug.cgi?id=1851150"
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
labels:
- source
- medium
Expand All @@ -81,7 +81,7 @@ page:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1822124
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
is_baseline:
type: string
description: |
Expand All @@ -102,7 +102,7 @@ page:
- "https://bugzilla.mozilla.org/show_bug.cgi?id=1848187"
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05

navigator:
geo:
Expand All @@ -121,7 +121,7 @@ navigator:
- https://github.com/mdn/yari/pull/7457#issuecomment-1296934544
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
geo_iso:
type: string
lifetime: application
Expand All @@ -138,24 +138,7 @@ navigator:
- https://github.com/mdn/yari/pull/7457#issuecomment-1296934544
notification_emails:
- [email protected]
expires: 2024-09-05
user_agent:
type: string
lifetime: application
send_in_pings:
- page
- action
description: |
The navigators user agent.
data_sensitivity:
- web_activity
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1894992
data_reviews:
- https://github.com/mdn/yari/pull/11065
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
user_languages:
type: string_list
lifetime: application
Expand All @@ -172,7 +155,7 @@ navigator:
- https://github.com/mdn/yari/pull/7457#issuecomment-1296934544
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
subscription_type:
type: string
lifetime: application
Expand All @@ -190,7 +173,7 @@ navigator:
- https://github.com/mdn/yari/pull/7457#issuecomment-1296934544
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
viewport_breakpoint:
type: string
description: |
Expand All @@ -208,44 +191,7 @@ navigator:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1820819
notification_emails:
- [email protected]
expires: 2024-09-05
viewport_ratio:
type: quantity
unit: percentage
description: |
The ratio of viewport width to viewport height,
expressed as a percentage.
lifetime: application
send_in_pings:
- page
- action
data_sensitivity:
- interaction
bugs:
- https://mozilla-hub.atlassian.net/browse/MP-282
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1820819
notification_emails:
- [email protected]
expires: 2024-09-05
viewport_horizontal_coverage:
type: quantity
unit: percentage
description: |
The ratio of viewport width to screen width, expressed as a percentage.
lifetime: application
send_in_pings:
- page
- action
data_sensitivity:
- interaction
bugs:
- https://mozilla-hub.atlassian.net/browse/MP-282
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1820819
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05

element:
clicked:
Expand All @@ -263,7 +209,7 @@ element:
- https://github.com/mdn/yari/pull/6813#issuecomment-1203705308
notification_emails:
- [email protected]
expires: 2024-09-05
expires: 2025-09-05
extra_keys:
source:
description: |
Expand Down

0 comments on commit 852d867

Please sign in to comment.