Parser tools for Mozilla's Glean telemetry
Parser tools for Mozilla's Glean telemetry.
Contains various utilities for handling
pings.yaml for the
Glean SDKs. This includes producing generated
code for various integrations, linting and coverage testing.
- How to Contribute. Please file bugs in bugzilla.
- User documentation for Glean.
- Python 3.7 (or later)
The following library requirements are installed automatically when
glean_parser is installed by
$ glean_parser --help
metrics.yaml, translate to Kotlin format, and
$ glean_parser translate -o output_dir -f kotlin metrics.yaml
Check a Glean ping against the ping schema:
$ glean_parser check < ping.json
- Warn about empty or TODO-tagged data reviews in the list (#634)
unitfield on all metrics, but warn for all but quantity and custom distribution (#636)
unitfield for string again, but warn about it in the linter (#634)
unitfield for custom distribution again (#633)
- Add Ruby log outputter (
- BREAKING CHANE:
pinglifetime metrics on the events ping are now disallowed (#625)
unitfield for anything but quantity (#630). Note that this was already considered the case, now the code enforces it.
- BREAKING CHANGE: Dropped support for Python 3.6 (#615)
- Allow metadata to configure precise timestamps in pings (#592)
- Small updates to the
- Increased the maximum metric name length in version 2.0.0 schema (#596)
- BREAKING CHANGE: Remove exposed
- Rust: Removed
__glean_metric_mapsfrom the Rust Jinja template. This functionality is better placed downstream (Bug 1816526)
- New lint: check that all referenced pings are known (#584)
- Unbreak last minor release (#579)
- Remove yamllint integration (#578)
- ENHANCEMENT: Labels in
labels:fields may now contain any printable ASCII characters (bug 1672273)
- BUGFIX: Enforce ordering of generation of Pings, Metrics and Tags such that order is deterministic (bug 1820334)
- BUGFIX: Remove internal-only fields from serialized metrics data (#550)
- FEATURE: New subcommand:
dumpto dump the metrics data as JSON (#550)
- BUGFIX: Kotlin: Generate enums with the right generic bound for ping reason codes (#551).
- BREAKING CHANGE: Fully remove support for the old events API (#549)
Adds a new lint
OLD_EVENT_APIto warn about missing
typeattributes on event extra keys. Note that the Glean SDK already dropped support for the old events API.
- BUGFIX: Correct code generation for labeled metrics in Rust (#533)
- BUGFIX: Correctly serialize
Ratesfor Rust code (#530)
- Feature: Wrap labeled metric's static labels list as CoW strings (requires updated Glean support) (#534)
- events: Increase extras limit to 15 (bug 1798713)
- [data-review] Use a template to generate the Data Review Request template (bug 1772605)
- Make tag and no_lint order deterministic (#518)
- Swift: Add a conditional
import Foundationto support generating metrics when Glean is delivered via the AppServices iOS megazord
- Rust: Use correct name for a ping in generated code.
- [data-review] Include extra keys' names and descriptions in data review template (bug 1767027)
- Raise limit on number of statically-defined labels to 4096. (bug 1772163)
- Fix Rust code generation for new UniFFI interface (#491, #494, #495)
- Relax version requirement for MarkupSafe. Now works with MarkupSafe v1.1.1 to v2.0.1 inclusive again.
- BUGFIX: Add missing
extra_argsto Rust constructor generation (bug 1765855)
- Breaking change:
glean_parsernow generates metrics compatible with the UniFFI-powered Glean SDK. This is not backwards-compatible with previous versions.
- Generate Rate, Denominator and Numerator metrics for Kotlin and Swift
These will cause a build failure by default, but can be turned into warnings on request.
-s fail_rates=falseto enable warning-only mode.
- BUGFIX: Revert changes made on v5.1.1.
- The issues addressed by those changes, were non-issues and result of misuse of the APIs.
- BUGFIX: Fix issues with Swift templates (bug 1749494)
- Make metrics and pings all
- Make pings
- Make metrics and pings all
- Fix the logic for the metric expiration by version (bug 1753194)
- Remove C# support (#436).
- Add support for Rust code generation (bug 1677434)
- Report an error if no files are passed (bug 1751730)
- [data-review] Report an error if no metrics match provided bug number (bug 1752576)
- [data-review] Include notification_emails in list of those responsible (bug 1752576)
- Add support for expiring metrics by the provided major version (bug 1753194)
Support global file-level tags in metrics.yaml (bug 1745283)
Glinter: Reject metric files if they use
unitby mistake. It should be
Automatically generate a build date when generating build info (#431). Enabled for Kotlin and Swift. This can be changed with the
build_datecommand line option.
build_date=0will use a static unix epoch time.
build_date=2022-01-03T17:30:00will parse the ISO8601 string to use (as a UTC timestamp). Other values will throw an error.
glean_parser translate --format kotlin --option build_date=2021-11-01T01:00:00 path/to/metrics.yaml
- BUGFIX: Skip tags for code generation (#409)
- Support tags in glean parser (bug 1734011)
- Improve the schema validation error messages. They will no longer include
OrderedDict(...)on Python 3.7 and later (bug 1733395)
- Officially support Python 3.10
- Add support for Text metric type (#374)
- Reserve the
defaultping name. It can't be used as a ping name, but it can be used in
- Define an interface with the allowed extras for each event on the TypeScript template. (bug 1693487)
- Add a command
data-reviewto generate a skeleton Data Review Request for all metrics matching a supplied bug number. (bug 1704541)
- Enable custom distribution outside of GeckoView (
- Import the Glean QML module from inside each generated file, removing the requirement to import Glean before importing any of the generated files;
- Prodive a
qmldirfile exposing all generated files;
- Drop the
- Add a new
- Add missing import for Kotlin code (#339)
- Use a plain Kotlin type in the generated interface implementation (#339)
- Generate additional generics for event metrics (#339)
- For Kotlin skip generating
GleanBuildInfo.ktwhen requested (with
- Fix another bug in the Swift code generation when generating extra keys (#334)
- Fix Swift code generation bug for pings (#333)
- Generate new event API construct (#321)
- Add option to add extra introductory text to generated markdown (#298)
platformoption. If this option is set to
qtthe generated templates will be Qt compatible. Default value is
- BUGFIX: Remove the "DO NOT COMMIT" notice from the documentation.
- Recommend to not commit as well as to not edit the generated files. (bug 1706042)
- Raise limit on number of statically-defined lables to 100. (bug 1702263)
- BUGFIX: Version 2.0.0 of the schema now allows the "special"
glean_.*ping names for Glean-internal use again.
- Remove support for JWE metric types.
- Add parser and object model support for
ratemetric type. (bug 1645166)
- Add parser and object model support for telemetry_mirror property. (bug 1685406)
- Glean.js has updated it's export strategy. It will now export each metric type as an independent module;
- Glean.js has dropped support for non ES6 modules.
- Add support for generating Typescript code. (bug 1692157)
- The templates added generate metrics and pings code for Glean.js.
glean_parserhas a new subcommand
coverageto convert raw coverage reports into something consumable by coverage tools, such as codecov.io
- The path to the file that each metric is defined in is now stored on the
- Leverage the
- The Kotlin generator now generates static build information that can be passed
Glean.initializeto avoid calling the package manager at runtime.
- The templates added generate metrics and pings code for Glean.js.
New versions 2.0.0 of the
pings.yamlschemas now ship with
glean_parser. These schemas are different from version 1.0.0 in the following ways:
- Bugs must be specified as URLs. Bug numbers are disallowed.
- The legacy ping names containing underscores are no longer allowed. These
glean_*). In these cases, the
_should be replaced with
To upgrade your app or library to use the new schema, replace the version in the
Breaking change: It is now an error to use bug numbers (rather than URLs) in ping definitions.
Add the line number that metrics and pings were originally defined in the yaml files.
- BUGFIX: Linter output can now be redirected correctly (1675771).
- Breaking change:
glean_parserwill now return an error code when any of the input files do not exist (unless the
--allow-missing-filesflag is passed).
- Generated code now includes a comment next to each metric containing the name
of the metric in its original
- When metrics don't provide a
unitparameter, it is not included in the output (as provided by probe-scraper).
- BUGFIX: Ensure Kotlin arguments are deterministically ordered
- Fix deploy step to update pip before deploying to pypi.
SUPERFLUOUS_NO_LINTwarning has been removed from the glinter. It likely did more harm than good, and makes it hard to make
metrics.yamlfiles that pass across different versions of
- Expired metrics will now produce a linter warning,
- Expiry dates that are more than 730 days (~2 years) in the future
will produce a linter warning,
- Allow using the Quantity metric type outside of Gecko.
- New parser configs
custom_validate_expiresadded. These are both functions that take the
expiresvalue of the metric and return a bool. (See
Metric.validate_expires). These will allow FOG to provide custom validation for its version-based
- BUGFIX: Support HashSet and Dictionary in the C## generated code.
- BUGFIX: Generate valid C## code when using Labeled metric types.
- BUGFIX: Add missing column to correctly render markdown tables in generated documentation.
- Breaking change: The internal ping
deletion-requestwas misnamed in pings.py causing the linter to not allow use of the correctly named ping for adding legacy ids to. Consuming apps will need to update their metrics.yaml if they are using
- Rename the
data_sensitivityto be clearer.
- Add support for JWE metric types.
- Add a
data_sensitivityfield to all metrics for specifying the type of data collected in the field.
- Add support for generating C## code.
- BUGFIX: The memory unit is now correctly passed to the MemoryDistribution metric type in Swift.
- BUGFIX: look for metrics in send_if_empty pings. Metrics for these kinds of pings were being ignored.
- Support for Python 3.5 has been dropped.
- BUGFIX: The ordering of event extra keys will now match with their enum, fixing a serious bug where keys of extras may not match the correct values in the data payload. See https://bugzilla.mozilla.org/show_bug.cgi?id=1648768.
- Breaking change: (Swift only) Combine all metrics and pings into a single
glintermessages have been improved with more details and to be more actionable.
- A maximum of 10
extra_keysis now enforced for
- BUGFIX: the
Lifetimeenum values now match the values of the implementation in mozilla/glean.
- BUGFIX: yamllint errors are now reported using the correct file name.
- Support for using
time_unitparameter to control the range of acceptable values is documented. The default unit for this use case is
nanosecondto avoid creating a breaking change. See bug 1630997 for more information.
- Dependencies that depend on the version of Python being used are now specified using the Declaring platform specific dependencies syntax in setuptools. This means that more recent versions of dependencies are likely to be installed on Python 3.6 and later, and unnecessary backport libraries won't be installed on more recent Python versions.
- The minimum version of the runtime dependencies has been lowered to increase compatibility with other tools. These minimum versions are now tested in CI, in addition to testing the latest versions of the dependencies that was already happening in CI.
- Breaking change: glinter errors found during the
translatecommand will now return an error code. glinter warnings will be displayed, but not return an error code.
glean_parsernow produces a linter warning when
userlifetime metrics are set to expire. See bug 1604854 for additional context.
- Breaking change: The regular expression used to validate labels is stricter and more correct.
- Add more information about pings to markdown documentation:
- State whether the ping includes client id;
- Add list of data review links;
- Add list of related bugs links.
glean_parsernow makes it easier to write external translation functions for different language targets.
glean_parsernow works on 32-bit Windows.
- Dropped the
- Constrained the
MarkupSafetransitive dependencies to versions that support Python 3.5.
- BUGFIX: Fix rendering of first element of reason list.
- BUGFIX: Reason codes are displayed in markdown output for built-in pings as well.
- BUGFIX: Reason descriptions are indented correctly in markdown output.
- BUGFIX: To avoid a compiler error, the
@JvmNameannotation isn't added to private members.
- Breaking Change (Java API) Have the metrics names in Java match the names in Kotlin. See Bug 1588060.
- The reasons a ping are sent are now included in the generated markdown documentation.
- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no longer supports Python 3.5.
- BUGFIX: Fixes an import error in generated Kotlin code.
- BUGFIX: Generated Swift code now includes
import Glean, unless generating for a Glean-internal build.
- Remove default schema URL from
schemaargument required for CLI
- BUGFIX: Avoid default import in Swift code for Glean itself
- BUGFIX: Restore order of fields in generated Swift code
- Support for
reasoncodes on pings was added.
- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no longer supports Python 3.5 (backported from 1.17.3).
- BUGFIX: Also allow the legacy name
send_in_pingsparameter on metrics
- BUGFIX: Also allow the legacy name
- Add project title to markdown template.
- Remove "Sorry about that" from markdown template.
- BUGFIX: Replace dashes in variable names to force proper naming
- BUGFIX: Use a pure Python library for iso8601 so there is no compilation required.
- BUGFIX: Add some additional ping names to the non-kebab-case allow list.
- Restrict new pings names to be kebab-case and change
glean_parsernow supports Python versions 3.5, 3.6, 3.7 and 3.8.
translatecommand will no longer clear extra files in the output directory.
- BUGFIX: Ensure all newlines in comments are prefixed with comment markers
- BUGFIX: Escape Swift keywords in variable names in generated code
- Generate documentation for pings that are sent if empty
- Reserve the
- Added a new flag
glintercommand now performs
yamllintvalidation on registry files.
- The Kotlin linter
detektis now run during CI, and for local testing if installed.
- Python 3.8 is now tested in CI (in addition to Python 3.7). Using
toxfor this doesn't work in modern versions of CircleCI, so the
toxconfiguration has been removed.
yamllinthas been added to test the YAML files on CI.
- ⚠ Metric types that don't yet have implementations in glean-core
have been removed. This includes
use_counter, as well as many labeled metrics that don't exist.
- Allow a Swift lint for generated code
- New lint: Restrict what metric can go into the
- New lint: Warn for slight misspellings in ping names
- BUGFIX: change Labeled types labels from lists to sets.
- Use lists instead of sets in Labeled types labels to ensure that the order of
the labels passed to the
glinterwill now check for duplicate labels and error if there are any.
- Add labels from Labeled types to the Extra column in the Markdown template.
- BUGFIX: Don't call
- Don't include Glean internal metrics in the generated markdown.
- Glinter now warns when bug numbers (rather than URLs) are used.
- BUGFIX: add
MemoryUnitimports in Kotlin generated code.
- Removed unsupported labeled metric types.
- Fix indentation for generated Swift code
- Created labeled metrics and events in Swift code and wrap it in a configured namespace
memory_unitis now passed to the Kotlin generator.
- A new parser config,
do_not_disable_expired, was added to turn off the feature that expired metrics are automatically disabled. This is useful if you want to retain the disabled value that is explicitly in the
glinterwill now report about superfluous
glintertool is now included to find common mistakes in metric naming and setup. This check is run during
translateand warnings will be displayed. ⚠ These warnings will be treated as errors in a future revision.
- NEW: Support for outputting metrics in Swift.
- BUGFIX: Provides a helpful error message when
geckoview_datapointis used on an metric type that doesn't support GeckoView exfiltration.
- Generate a lookup table for Gecko categorical histograms in
- Introduce a 'Swift' output generator.
- Documentation only.
- Added support for generating markdown documentation from
quantitymetric type has been added.
includeClientIdwas not being output for PingType.
memory_distributionmetric type has been added.
custom_distributionmetric type has been added.
labeled_timespanis no longer an allowed metric type.
- Add a special
- First release to start following strict semver.
- First release on PyPI.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for glean_parser-10.0.3-py3-none-any.whl