Open-Source Wikis

/

Gecko

/

Features

/

Telemetry / Glean

mozilla/gecko-dev

Telemetry / Glean

Firefox emits telemetry through two parallel systems:

  1. Legacy Telemetry — histograms, scalars, events. Lives in toolkit/components/telemetry/.
  2. Glean — Mozilla's modern, schema-validated SDK. Lives in toolkit/components/glean/ (a thin Firefox glue around the Rust glean-core crate).

The HEAD commit at this snapshot (5836a062726f) is part of the long-running migration from legacy Telemetry to Glean. New metrics should always use Glean.

Glean basics

A metric is declared in a YAML file:

my.feature:
  click_count:
    type: counter
    description: Number of clicks on the feature.
    bugs: ['https://bugzilla.mozilla.org/show_bug.cgi?id=1234567']
    data_reviews: ['...']
    notification_emails: ['...@mozilla.com']
    expires: 'never'

Schemas live next to the implementation (e.g., dom/metrics.yaml). The build runs the Glean code generator (vendored under toolkit/components/glean/build_scripts/) to produce C++/JS APIs:

mozilla::glean::my_feature::click_count.Add(1);
Glean.myFeature.clickCount.add(1);

Pings

Pings are batches of metrics submitted to Mozilla's telemetry pipeline. Defined in pings.yaml files (e.g., dom/pings.yaml). Standard pings include metrics, events, baseline, plus per-feature pings.

Legacy Telemetry

Histograms (Histograms.json), scalars (Scalars.yaml), and events (Events.yaml) live under toolkit/components/telemetry/. Most new code should NOT add legacy metrics; the project is to deprecate them.

Tooling

  • about:telemetry — view current pings.
  • about:glean — view Glean state.
  • ./mach lint --linter perfdocs --linter glean — schema validation.
  • Glean Debug View tools in docs.telemetry.mozilla.org.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Telemetry / Glean – Gecko wiki | Factory