-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extensionTelemetry #10057
Add extensionTelemetry #10057
Conversation
f61f638
to
fa836d6
Compare
This can have an updated title (dropping |
@mcleinman yes sorry :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Several questions.
It seems like we're doing a bunch of work to allow the user to have glean enabled for the extension but not the client (or the reverse). I'm not sure this is worth the code needed for it - was that a product directive?
description: > | ||
True if the user has disabled the VPN for firefox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over what length of time are we measuring this? I believe we default to ping
in Glean... is this supposed to be "has disabled this ever"? Or "has disabled this in the current session"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metric has a lifetime of ping (and will be attached similar to using_system_language
) , the underlying info lives in the Settings and will be cleaned on logout.
We want to measure "has this user ever ever used feature x?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But unlike using_system_language
, we're sending it in every start ping (in recordAllFlags
). This seems more appropriate for a lifetime of user
- a lifetime of ping
where we record it from a app-saved setting doesn't feel like how we'd typically handle Glean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed that part :)
Yeeeep. Product ask (q_q )" - for the extension we have to offer an extra data opt-in flow just for data related to the extension. |
Maybe this is a silly question to ask, but why do we need an API for the extension send telemetry to the client, only for the client to turn around and send to glean? Couldn't the extension send the telemetry to glean on its own? Surely Mozilla already has some solid mechanisms for intstrumenting extensions in this way? |
src/settingslist.h
Outdated
@@ -783,3 +785,23 @@ SETTING_BOOL(addonApiSetting, // getter | |||
false // sensitive (do not log) | |||
) | |||
#endif | |||
|
|||
SETTING_UINT(extensionTelemetryFlags, // getter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like an anti-pattern for Glean, and has some possible data retention concerns. The point of Glean is that it handles recording our metrics, and the lifetimes should be able to handle our use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right, TIL about lifetime =! ping
- ripped all of that code out and moved that into the metrics.yaml
That is a fair question! - Glean.js is not supported for extensions anymore, so noone knows what would break, there is |
@@ -73,3 +73,23 @@ daemonsession: | |||
(Android only) Sent every three hours during an active VPN session. | |||
daemon_end: > | |||
Sent after as session ending metric is recorded. | |||
extensionsession: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: There were two line breaks, I thought there should be just one (but wasn't clear, sorry). It was updated to be zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few nits, and one metric typo that I think should be fixed before merging. Thank you!
src/telemetry/extension_metrics.yaml
Outdated
- [email protected] | ||
expires: 2025-06-30 | ||
|
||
fx_protetion_disabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More than other typos, I think this typo should be fixed before merging as it's difficult to change metric names.
fx_protetion_disabled: | |
fx_protection_disabled: |
subscription_needed, signin_needed, split_tunneled | ||
type: string | ||
expires: 2025-06-30 | ||
fx_protection_enabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fx_protection_enabled: | |
fx_protection_enabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Line break
- Added extension_metrics.yaml file to the telemetry directory. - Defined new metrics for extension usage, including onboarding completion, feature usage, and website exclusions. - Added extension_metrics.yaml to the list of metrics sent in the extensionsession ping. - Updated pings.yaml to include extensionsession as a new ping type. - Included client ID in extensionsession ping. - Updated bugs, data reviews, and notification emails for the new metrics. - Added reasons for sending extensionsession ping on session start and end. - Updated comments to reflect changes.
- Added a new `WebExtensionTelemetry` class to handle WebExtension telemetry events. - Implemented `fromJson` function to parse JSON telemetry data into `TelemetryInfo` objects. - Added `recordTelemetry` function to record telemetry events to Glean. - Implemented `startSession` and `stopSession` functions to track session start and end events. - Added new handlers for various telemetry events and flags in `handlers.cpp`. - Updated `webextensionadapter.cpp` to handle telemetry requests. - Updated `pings.yaml` to include new telemetry pings. - Updated `webextensiontelemetry.h` to define new telemetry functions and structures.
- Update MZGlean::upadateUploadEnabled() to MZGlean::updateUploadEnabled() for consistency in naming. - Ensure that the static function updateUploadEnabled() is called correctly in the MZGlean class. - Update the documentation comments for clarity and consistency.
- Changed the function declaration of `flag` from `consteval` to `constexpr` to ensure that it is a compile-time constant expression. - This change ensures that the function is not evaluated at runtime, improving performance and avoiding potential issues with runtime evaluation.
077c633
to
5646001
Compare
* Add extension metrics to extension session ping - Added extension_metrics.yaml file to the telemetry directory. - Defined new metrics for extension usage, including onboarding completion, feature usage, and website exclusions. - Added extension_metrics.yaml to the list of metrics sent in the extensionsession ping. - Updated pings.yaml to include extensionsession as a new ping type. - Included client ID in extensionsession ping. - Updated bugs, data reviews, and notification emails for the new metrics. - Added reasons for sending extensionsession ping on session start and end. - Updated comments to reflect changes. * Add support for WebExtension Telemetry - Added a new `WebExtensionTelemetry` class to handle WebExtension telemetry events. - Implemented `fromJson` function to parse JSON telemetry data into `TelemetryInfo` objects. - Added `recordTelemetry` function to record telemetry events to Glean. - Implemented `startSession` and `stopSession` functions to track session start and end events. - Added new handlers for various telemetry events and flags in `handlers.cpp`. - Updated `webextensionadapter.cpp` to handle telemetry requests. - Updated `pings.yaml` to include new telemetry pings. - Updated `webextensiontelemetry.h` to define new telemetry functions and structures. * Allow filtering on a per-ping basis * Use glean lifetimes instead of homebrewed stuff * Address feedback in metrics_yaml * Address feedback in pings.yaml * fix typos in c++ * Update upload enablement in MZGlean - Update MZGlean::upadateUploadEnabled() to MZGlean::updateUploadEnabled() for consistency in naming. - Ensure that the static function updateUploadEnabled() is called correctly in the MZGlean class. - Update the documentation comments for clarity and consistency. * Update flag handling in webextensiontelemetry.cpp - Changed the function declaration of `flag` from `consteval` to `constexpr` to ensure that it is a compile-time constant expression. - This change ensures that the function is not evaluated at runtime, improving performance and avoiding potential issues with runtime evaluation.
Description
This PR adds commands for the extension to send telemetry to the client.
It's a bit bigger, therefore i've split this across 3 commits, for easyier reivew.
I've only added the metrics, the data review happens in a google doc, i can link that if it's done.
I add 3 commands:
{t:telemetry, name: metric_name: args: any}
{t:start_session}
{t:stop_session}
- Those allow the extension to send any events or counts. For the bools we save them and attach them to the next ping, similar how we do that with our settings related bools.I tried the least refactoring solution to allow us to enable telemetry either for the extension or the client. All data is attached to a ping with a name. I've added the ability for glean to filter out on a per
ping_name
basis. I use that to filter the extensions pings if they are not enabled and the client pings if those are disabled.