{"id":21387,"library":"glean-parser","title":"Glean Parser","description":"Parser tools for Mozilla's Glean telemetry system. Version 19.0.0, released on a monthly cadence. Used to translate YAML-based metric definitions into language-specific bindings (Swift, Kotlin, Python, etc.) and to perform linting and validation.","status":"active","version":"19.0.0","language":"python","source_language":"en","source_url":"https://github.com/mozilla/glean_parser","tags":["telemetry","glean","mozilla","metrics","yaml","codegen"],"install":[{"cmd":"pip install glean-parser","lang":"bash","label":"latest"}],"dependencies":[],"imports":[{"note":"translate moved to top-level module in v5","wrong":"from glean_parser.util import translate","symbol":"translate","correct":"from glean_parser import translate"},{"note":"","wrong":"","symbol":"validate_ping","correct":"from glean_parser import validate_ping"},{"note":"lint_glean is the public API; glinter is internal and removed in v19","wrong":"from glean_parser.lint import glinter","symbol":"lint_glean","correct":"from glean_parser import lint_glean"}],"quickstart":{"code":"from glean_parser import translate\n\n# Validate and translate a metrics.yaml file to Kotlin\ntranslate.translate(\n    input_filepaths=[\"metrics.yaml\"],\n    output_dir=\"./generated\",\n    option={\"allow_reserved\": False}\n)","lang":"python","description":"This example runs the translator on a single metrics.yaml file, outputting Kotlin bindings."},"warnings":[{"fix":"Remove any calls to `glean_parser coverage ...`. Check `glean_parser --help` for available commands.","message":"In v19, the `coverage` subcommand was removed entirely. If you relied on it, use external coverage tools.","severity":"breaking","affected_versions":">=19.0.0"},{"fix":"Pass options as a dict: `translate(..., option={\"allow_reserved\": False})` instead of CLI-style `--option allow_reserved=false`.","message":"The `--option` flag for `translate` is being replaced by structured arguments. In future versions, `options` dict will be the only way.","severity":"deprecated","affected_versions":">=18.0.0 <20.0.0"},{"fix":"Set `option={\"allow_reserved\": False}` when calling `translate`.","message":"Always use `allow_reserved=False` in production. Without it, reserved metric names may clash with Glean internals.","severity":"gotcha","affected_versions":"all"},{"fix":"Update server-side schema to match new timestamp handling. See PR #831.","message":"Event timestamp values in server templates changed in v19.0.0. Verify that your server-side ingestion expects the new format.","severity":"gotcha","affected_versions":"19.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install glean-parser`. Verify the environment with `python -m pip list | grep glean-parser`.","cause":"The package is not installed, or installed in a different environment.","error":"ModuleNotFoundError: No module named 'glean_parser'"},{"fix":"Use `from glean_parser import translate` instead.","cause":"The import path changed in v5. The function is now at `glean_parser.translate`.","error":"ImportError: cannot import name 'translate' from 'glean_parser.util'"},{"fix":"Remove `coverage` usage. Use external testing coverage tools if needed.","cause":"The `coverage` subcommand was removed in v19.","error":"glean_parser.cli.main: error: unrecognized arguments: --coverage"},{"fix":"Use `option={\"allow_reserved\": False}` to avoid this, or rename the metric. If intentional, pass `allow_reserved=True` (not recommended).","cause":"The metric name conflicts with a reserved Glean identifier.","error":"glean_parser.lint.LinterError: metric 'my.metric' is reserved"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}