Messaging System & Onboarding Telemetry
This document (combined with the messaging system ping section of the Glean Dictionary), is now the place to look first for Messaging System and Onboarding telemetry information. For historical reasons, there is still some related documentation mixed in with the Activity Stream documentation. If you can’t find what you need here, check old metrics we collect and the old data dictionary.
Collection with Glean
Code all over the messaging system passes JSON ping objects up to a few central spots. It may be annotated with attribution along the way, and/or adjusted by some policy routines before it’s sent. The JSON will be transformed slightly further before being sent to Glean.
Design of Messaging System Data Collections
Data is sent in the
Messaging System Ping.
Which Messaging System Ping you get is recorded with
Ping Type.
If you wish to expand the collection of data,
consider whether data belongs on the messaging-system
ping
(usually when data is timely to the ping itself)
or if it’s a more general collection,
in which case the data can go on the default send_in_pings
entry,
which is the metrics
ping.
In either case, you can add a metric definition in the
metrics.yaml
file.
Adding or changing telemetry
A general process overview can be found in the Activity Stream telemetry document.
Note that when you need to add new metrics (i.e. JSON keys), they MUST to be added to browser/components/newtab/metrics.yaml in order to show up correctly in the Glean data.
Avoid adding any new nested objects, because Glean can’t handle these. In the best case, any such additions will end up being flattened or stringified before being sent.
Monitoring FxMS Telemetry Health
The OMC team owns an OpMon dashboard for the FxMS Desktop Glean telemetry with alerts. Note that it can only show one channel at any given time, here’s a link to Windows Release. The dashboard is specified in firefox-messaging-system.toml, and reading the source can help clarify exactly what it means. We are the owner of this file, and are encouraged to adjust it to our needs, though it’s probably a good idea to get review from someone in Data Science.
The current plan is to review the OpMon dashboard as a group in our weekly
triage meeting, note anything that seems unusual to our Google docs
log,
and, if we want to investigate further, file a bug that blocks
fxms-glean
.
The dashboard is configured to alert in various cases, and those alerts can be seen at the bottom of the dashboard. As of this writing, the alerts have some noise to be cleaned up before we can automatically act on them.
Local Debugging
Local debugging involves logging telemetry to console and/or using Glean’s ergonomic test APIs and/or the Glean Debug Ping Viewer which you can learn more about on about:glean
.
The simplest way to understand the telemetry you’ll generate is to turn on logging. In about:config
set browser.newtabpage.activity-stream.telemetry
to true
and messaging-system.log
to debug
.
You can now play around with the message you care about using ASRouter devtools with the logs generating in the browser console.
To monitor events using about:glean
you can use the following mach command. This will turn on telemetry logging and open about:glean
.
MOZ_LOG="glean_core::upload:3" ./mach run --setpref browser.newtabpage.activity-stream.telemetry=true about:glean
Click the checkbox in step 3 (‘Optional. Check the preceding box if you want pings to also be logged when they are submitted…’)
Click the ‘Apply settings and submit ping’ button in step 4
Visit
about:welcome
(there may be a delay before the ping shows up in the terminal)
Appendix: A Short Glean Primer, as it applies to this project (courtesy of Chris H-C)
Glean is a data collection library by Mozilla for Mozilla. You define metrics like counts and timings and things, and package those into pings which are the payloads sent to our servers.
You can see current FxMS Glean metrics and pings in the desktop section of the Glean Dictionary. The layer embedding Glean into Firefox Desktop is called Firefox on Glean (FOG).
Documentation will be automatically generated and hosted on the Glean Dictionary, so write long rich-text Descriptions and augment them off-train with Glean Annotations.
Schemas for ingestion are automatically generated. You can go from landing a new ping to querying the data being sent within two days.
Make a mistake? No worries. Changes are quick and easy and are reflected in the received data within a day.
If you have any questions, the Glean Team is available across a lot of timezones on the
#glean:mozilla.org
channel on Matrix and Slack#data-help
.