Skip to content

Adding Glean Telemetry Events

roux g. buciu edited this page Mar 1, 2024 · 15 revisions

This documentation aims at explaining how to ask for review whenever new Telemetry is added in the project.

New Data

a) Request Data Review

Fill out the following form and request a data review for the event(s). The form can be attached in the same Issue / PR. Best to do it in the Issue as it can take anywhere from few hours to 2 days for the review.

Form: https://github.com/mozilla/data-review/blob/main/request.md

Tag one of the following mobile Data Stewards

  • Daniela Arcese (iOS)
  • Roux Buciu (iOS)
  • Roger Yang (Android)

❗ Any changes to the Adjust implementation must also go through a data review

Sample: https://github.com/mozilla-mobile/firefox-ios/issues/6886

Ref: https://wiki.mozilla.org/Firefox/Data_Collection

b) Changes to be made in the code

  • Update Metrics.yaml: This is used for generating Metrics.swift for glean telemetry
event_name                // Use underscore instead of a dash
  new_tab_pressed:
    type: counter         // String, counter, boolean, labeled_counter
    description: |        // Add appropriate description 
      This place is reserved for description of the event
    bugs:                 // Add link to the issue. Link the Github issue is it has one. Otherwise fallback to the JIRA issue.
      - https://github.com/mozilla-mobile/firefox-ios/issues/6886
    data_reviews:         // Add link to where the review got approved
      - https://github.com/mozilla-mobile/firefox-ios/issues/6886
    notification_emails:  // Person responsible for iOS use the email below
      - fx-ios-data-stewards@mozilla.com
    expires: "2021-07-21" // How long do we need to track this event. Ex 1yr

💡 For the expiry date, try to group them by feature to make renewal easier (ex. all telemetry related to bookmarks should expire on the same date). If it is something that we will always need to collect, it can be a permanent collection.

  • Run the app so Glean generates Metrics.swift file that can be used to add gleanRecord
  • Update TelemetryWrapper.swift Add: EventCategory | EventMethod | EventObject Update: Add case for the event in func gleanRecordEvent like below
// Start Search Button
    case (.action, .tap, .startSearchButton, _, _):
        GleanMetrics.Search.newTabPressed.add()

Sample: https://github.com/mozilla-mobile/firefox-ios/pull/7023

c) Finally, make PR with the apt changes mentioned in a) and b)

Renewing data

Every 6 months, the product team will review all telemetry and answer:

  • Is it still necessary to collect this data? If no, remove it.
  • If yes, should this data be renewed for another 6 months?

For renewal request, the following form needs to be completed: https://github.com/mozilla/data-review/blob/main/renewal_request.md

Sample: https://github.com/mozilla-mobile/firefox-ios/pull/8625

Relevant Links

For engineers, these are some past PRs that you can reference:

Clone this wiki locally