From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../glean_parser-11.0.1.dist-info/AUTHORS.md | 17 - .../glean_parser-11.0.1.dist-info/LICENSE | 373 ---------- .../glean_parser-11.0.1.dist-info/METADATA | 769 -------------------- .../glean_parser-11.0.1.dist-info/RECORD | 44 -- .../glean_parser-11.0.1.dist-info/WHEEL | 5 - .../glean_parser-11.0.1.dist-info/entry_points.txt | 2 - .../glean_parser-11.0.1.dist-info/top_level.txt | 1 - .../glean_parser-13.0.0.dist-info/AUTHORS.md | 17 + .../glean_parser-13.0.0.dist-info/LICENSE | 373 ++++++++++ .../glean_parser-13.0.0.dist-info/METADATA | 786 +++++++++++++++++++++ .../glean_parser-13.0.0.dist-info/RECORD | 48 ++ .../glean_parser-13.0.0.dist-info/WHEEL | 5 + .../glean_parser-13.0.0.dist-info/entry_points.txt | 2 + .../glean_parser-13.0.0.dist-info/top_level.txt | 1 + .../python/glean_parser/glean_parser/go_server.py | 145 ++++ .../python/glean_parser/glean_parser/metrics.py | 60 ++ .../python/glean_parser/glean_parser/pings.py | 4 + .../glean_parser/glean_parser/python_server.py | 130 ++++ .../python/glean_parser/glean_parser/rust.py | 23 +- .../glean_parser/schemas/metrics.2-0-0.schema.yaml | 13 + .../glean_parser/schemas/pings.2-0-0.schema.yaml | 15 + .../glean_parser/templates/go_server.jinja2 | 225 ++++++ .../glean_parser/templates/python_server.jinja2 | 194 +++++ .../glean_parser/templates/rust.jinja2 | 49 +- .../glean_parser/templates/swift.jinja2 | 1 + .../python/glean_parser/glean_parser/translate.py | 4 + .../python/glean_parser/glean_parser/util.py | 1 + 27 files changed, 2094 insertions(+), 1213 deletions(-) delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/AUTHORS.md delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/LICENSE delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/METADATA delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/RECORD delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/WHEEL delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/entry_points.txt delete mode 100644 third_party/python/glean_parser/glean_parser-11.0.1.dist-info/top_level.txt create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/AUTHORS.md create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/LICENSE create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/METADATA create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/RECORD create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/WHEEL create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/entry_points.txt create mode 100644 third_party/python/glean_parser/glean_parser-13.0.0.dist-info/top_level.txt create mode 100644 third_party/python/glean_parser/glean_parser/go_server.py create mode 100644 third_party/python/glean_parser/glean_parser/python_server.py create mode 100644 third_party/python/glean_parser/glean_parser/templates/go_server.jinja2 create mode 100644 third_party/python/glean_parser/glean_parser/templates/python_server.jinja2 (limited to 'third_party/python/glean_parser') diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/AUTHORS.md b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/AUTHORS.md deleted file mode 100644 index 525116ee7e..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/AUTHORS.md +++ /dev/null @@ -1,17 +0,0 @@ -# Credits - -## Development Lead - -- Jan-Erik Rediger -- Alessio Placitelli - -## Contributors - -See [the full list of contributors](https://github.com/mozilla/glean_parser/graphs/contributors). - -## Acknowledgements - -This package was created with -[Cookiecutter](https://github.com/audreyr/cookiecutter) and the -[audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) -project template. diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/LICENSE b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/LICENSE deleted file mode 100644 index a612ad9813..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/LICENSE +++ /dev/null @@ -1,373 +0,0 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/METADATA b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/METADATA deleted file mode 100644 index 201d8bb48b..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/METADATA +++ /dev/null @@ -1,769 +0,0 @@ -Metadata-Version: 2.1 -Name: glean-parser -Version: 11.0.1 -Summary: Parser tools for Mozilla's Glean telemetry -Home-page: https://github.com/mozilla/glean_parser -Author: The Glean Team -Author-email: glean-team@mozilla.com -Keywords: glean_parser -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Natural Language :: English -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Description-Content-Type: text/markdown -License-File: LICENSE -License-File: AUTHORS.md -Requires-Dist: appdirs >=1.4 -Requires-Dist: Click >=7 -Requires-Dist: diskcache >=4 -Requires-Dist: Jinja2 >=2.10.1 -Requires-Dist: jsonschema >=3.0.2 -Requires-Dist: PyYAML >=5.3.1 - -# Glean Parser - -Parser tools for Mozilla's Glean telemetry. - -## Features - -Contains various utilities for handling `metrics.yaml` and `pings.yaml` for [the -Glean SDKs](https://mozilla.github.io/glean). This includes producing generated -code for various integrations, linting and coverage testing. - -## Documentation - -- [How to Contribute](https://github.com/mozilla/glean_parser/blob/main/CONTRIBUTING.md). Please file bugs in [bugzilla](https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&bug_ignored=0&bug_severity=normal&bug_status=NEW&cf_fission_milestone=---&cf_fx_iteration=---&cf_fx_points=---&cf_status_firefox65=---&cf_status_firefox66=---&cf_status_firefox67=---&cf_status_firefox_esr60=---&cf_status_thunderbird_esr60=---&cf_tracking_firefox65=---&cf_tracking_firefox66=---&cf_tracking_firefox67=---&cf_tracking_firefox_esr60=---&cf_tracking_firefox_relnote=---&cf_tracking_thunderbird_esr60=---&product=Data%20Platform%20and%20Tools&component=Glean%3A%20SDK&contenttypemethod=list&contenttypeselection=text%2Fplain&defined_groups=1&flag_type-203=X&flag_type-37=X&flag_type-41=X&flag_type-607=X&flag_type-721=X&flag_type-737=X&flag_type-787=X&flag_type-799=X&flag_type-800=X&flag_type-803=X&flag_type-835=X&flag_type-846=X&flag_type-855=X&flag_type-864=X&flag_type-916=X&flag_type-929=X&flag_type-930=X&flag_type-935=X&flag_type-936=X&flag_type-937=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Unspecified&priority=P3&&rep_platform=Unspecified&status_whiteboard=%5Btelemetry%3Aglean-rs%3Am%3F%5D&target_milestone=---&version=unspecified). -- [User documentation for Glean](https://mozilla.github.io/glean/). -- [`glean_parser` developer documentation](https://mozilla.github.io/glean_parser/). - -## Requirements - -- Python 3.8 (or later) - -The following library requirements are installed automatically when -`glean_parser` is installed by `pip`. - -- appdirs -- Click -- diskcache -- Jinja2 -- jsonschema -- PyYAML - -## Usage - -```sh -$ glean_parser --help -``` - -Read in `metrics.yaml`, translate to Kotlin format, and -output to `output_dir`: - -```sh -$ glean_parser translate -o output_dir -f kotlin metrics.yaml -``` - -Check a Glean ping against the ping schema: - -```sh -$ glean_parser check < ping.json -``` - - -# Changelog - -## Unreleased - -## 11.0.1 - -- Fix javascript_server template to include non-event metric parameters in #record call for event metrics ([#643](https://github.com/mozilla/glean_parser/pull/643)) -- events: Increase extra key limit to 50 ([Bug 1869429](https://bugzilla.mozilla.org/show_bug.cgi?id=1869429)) - -## 11.0.0 - -- Add updated logging logic for Ruby Server ([#642](https://github.com/mozilla/glean_parser/pull/642)) -- Add support for event metric type in server-side JavaScript outputter ([DENG-1736](https://mozilla-hub.atlassian.net/browse/DENG-1736)) -- BREAKING CHANGE: Dropped support for Python 3.7 ([#638](https://github.com/mozilla/glean_parser/pull/638)) -- Add official support for Python 3.11+ ([#638](https://github.com/mozilla/glean_parser/pull/638)) - -## 10.0.3 - -- Warn about empty or TODO-tagged data reviews in the list ([#634](https://github.com/mozilla/glean_parser/pull/634)) -- Allow `unit` field on all metrics, but warn for all but quantity and custom distribution ([#636](https://github.com/mozilla/glean_parser/pull/636)) - -## 10.0.2 - -- Allow `unit` field for string again, but warn about it in the linter ([#634](https://github.com/mozilla/glean_parser/pull/634)) - -## 10.0.1 - -- Allow `unit` field for custom distribution again ([#633](https://github.com/mozilla/glean_parser/pull/633)) - -## 10.0.0 - -- Add Ruby log outputter (`ruby_server`) ([#620](https://github.com/mozilla/glean_parser/pull/620)) -- BREAKING CHANE: `ping` lifetime metrics on the events ping are now disallowed ([#625](https://github.com/mozilla/glean_parser/pull/625)) -- Disallow `unit` field for anything but quantity ([#630](https://github.com/mozilla/glean_parser/pull/630)). - Note that this was already considered the case, now the code enforces it. - -## 9.0.0 - -- BREAKING CHANGE: Dropped support for Python 3.6 ([#615](https://github.com/mozilla/glean_parser/issues/615)) -- Allow metadata to configure precise timestamps in pings ([#592](https://github.com/mozilla/glean_parser/pull/592)) - -## 8.1.1 - -- Small updates to the `javascript_server` tempalte to address lint warnings ([#598](https://github.com/mozilla/glean_parser/pull/598)) - -## 8.1.0 - -- Increased the maximum metric name length in version 2.0.0 schema ([#596](https://github.com/mozilla/glean_parser/pull/596)) - -## 8.0.0 - -- BREAKING CHANGE: Remove exposed `lint_yaml_files` function ([#580](https://github.com/mozilla/glean_parser/pull/580)) -- Rust: Removed `__glean_metric_maps` from the Rust Jinja template. This functionality is better placed downstream ([Bug 1816526](https://bugzilla.mozilla.org/show_bug.cgi?id=1816526)) -- New lint: check that all referenced pings are known ([#584](https://github.com/mozilla/glean_parser/pull/584)) -- Add experimental server-side JavaScript outputter ([FXA-7922](https://mozilla-hub.atlassian.net/browse/FXA-7922)) - -## 7.2.1 - -- Unbreak last minor release ([#579](https://github.com/mozilla/glean_parser/pull/579)) - -## 7.2.0 - -- Remove yamllint integration ([#578](https://github.com/mozilla/glean_parser/pull/578)) - -## 7.1.0 - -- ENHANCEMENT: Labels in `labels:` fields may now contain any printable ASCII characters ([bug 1672273](https://bugzilla.mozilla.org/show_bug.cgi?id=1672273)) -- BUGFIX: Enforce ordering of generation of Pings, Metrics and Tags such that order is deterministic ([bug 1820334](https://bugzilla.mozilla.org/show_bug.cgi?id=1820334)) - -## 7.0.0 - -- BUGFIX: Remove internal-only fields from serialized metrics data ([#550](https://github.com/mozilla/glean_parser/pull/550)) -- FEATURE: New subcommand: `dump` to dump the metrics data as JSON ([#550](https://github.com/mozilla/glean_parser/pull/550)) -- BUGFIX: Kotlin: Generate enums with the right generic bound for ping reason codes ([#551](https://github.com/mozilla/glean_parser/pull/551)). -- **BREAKING CHANGE:** Fully remove support for the old events API ([#549](https://github.com/mozilla/glean_parser/pull/549)) - Adds a new lint `OLD_EVENT_API` to warn about missing `type` attributes on event extra keys. - Note that the Glean SDK already dropped support for the old events API. - -## 6.4.0 - -- BUGFIX: Correct code generation for labeled metrics in Rust ([#533](https://github.com/mozilla/glean_parser/pull/533)) -- BUGFIX: Correctly serialize `Rates` for Rust code ([#530](https://github.com/mozilla/glean_parser/pull/530)) -- Feature: Wrap labeled metric's static labels list as CoW strings (requires updated Glean support) ([#534](https://github.com/mozilla/glean_parser/pull/534)) - -## 6.3.0 - -- events: Increase extras limit to 15 ([bug 1798713](https://bugzilla.mozilla.org/show_bug.cgi?id=1798713)) - -## 6.2.1 - -- Add support for Rate, Denominator and Numerator metrics for JavaScript. ([bug 1793777](https://bugzilla.mozilla.org/show_bug.cgi?id=1793777)) - -## 6.2.0 - -- [data-review] Use a template to generate the Data Review Request template ([bug 1772605](https://bugzilla.mozilla.org/show_bug.cgi?id=1772605)) -- Make tag and no\_lint order deterministic ([#518](https://github.com/mozilla/glean_parser/pull/518)) - -## 6.1.2 - -- Swift: Add a conditional `import Foundation` to support generating metrics when Glean is delivered via the AppServices iOS megazord - -## 6.1.1 - -- Rust: Use correct name for a ping in generated code. - -## 6.1.0 - -- [data-review] Include extra keys' names and descriptions in data review template ([bug 1767027](https://bugzilla.mozilla.org/show_bug.cgi?id=1767027)) -- Raise limit on number of statically-defined labels to 4096. ([bug 1772163](https://bugzilla.mozilla.org/show_bug.cgi?id=1772163)) -- Fix Rust code generation for new UniFFI interface ([#491](https://github.com/mozilla/glean_parser/pull/491), [#494](https://github.com/mozilla/glean_parser/pull/494), [#495](https://github.com/mozilla/glean_parser/pull/495)) - -## 6.0.1 - -- Relax version requirement for MarkupSafe. - Now works with MarkupSafe v1.1.1 to v2.0.1 inclusive again. - -## 6.0.0 - -- BUGFIX: Add missing `extra_args` to Rust constructor generation ([bug 1765855](https://bugzilla.mozilla.org/show_bug.cgi?id=1765855)) -- **Breaking change:** `glean_parser` now 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 -- Explicitly skip Rate, Denominator and Numerator metrics for JavaScript. - These will cause a build failure by default, but can be turned into warnings on request. - Use `-s fail_rates=false` to enable warning-only mode. - -## 5.1.2 - -- BUGFIX: Revert changes made on v5.1.1. - - The issues addressed by those changes, were non-issues and result of misuse of the APIs. - -## 5.1.1 - -- BUGFIX: Fix issues with Swift templates ([bug 1749494](https://bugzilla.mozilla.org/show_bug.cgi?id=1749494)) - - Make metrics and pings all `public` - - Make pings `static` - -## 5.1.0 - -- Add support for build info generation for JavaScript and Typescript targets ([bug 1749494](https://bugzilla.mozilla.org/show_bug.cgi?id=1749494)) - -## 5.0.1 - -- Fix the logic for the metric expiration by version ([bug 1753194](https://bugzilla.mozilla.org/show_bug.cgi?id=1753194)) - -## 5.0.0 - -- Remove C# support ([#436](https://github.com/mozilla/glean_parser/pull/436)). -- Add support for Rust code generation ([bug 1677434](https://bugzilla.mozilla.org/show_bug.cgi?id=1677434)) -- Report an error if no files are passed ([bug 1751730](https://bugzilla.mozilla.org/show_bug.cgi?id=1751730)) -- [data-review] Report an error if no metrics match provided bug number ([bug 1752576](https://bugzilla.mozilla.org/show_bug.cgi?id=1752576)) -- [data-review] Include notification_emails in list of those responsible ([bug 1752576](https://bugzilla.mozilla.org/show_bug.cgi?id=1752576)) -- Add support for expiring metrics by the provided major version ([bug 1753194](https://bugzilla.mozilla.org/show_bug.cgi?id=1753194)) - -## 4.4.0 - -- Support global file-level tags in metrics.yaml ([bug 1745283](https://bugzilla.mozilla.org/show_bug.cgi?id=1745283)) -- Glinter: Reject metric files if they use `unit` by mistake. It should be `time_unit` ([#432](https://github.com/mozilla/glean_parser/pull/432)). -- Automatically generate a build date when generating build info ([#431](https://github.com/mozilla/glean_parser/pull/431)). - Enabled for Kotlin and Swift. - This can be changed with the `build_date` command line option. - `build_date=0` will use a static unix epoch time. - `build_date=2022-01-03T17:30:00` will parse the ISO8601 string to use (as a UTC timestamp). - Other values will throw an error. - - Example: - - glean_parser translate --format kotlin --option build_date=2021-11-01T01:00:00 path/to/metrics.yaml - -## 4.3.1 - -- BUGFIX: Skip tags for code generation ([#409](https://github.com/mozilla/glean_parser/pull/409)) - -## 4.3.0 - -- Support tags in glean parser ([bug 1734011](https://bugzilla.mozilla.org/show_bug.cgi?id=1734011)) - -## 4.2.0 - -- Improve the schema validation error messages. They will no longer include `OrderedDict(...)` on Python 3.7 and later ([bug 1733395](https://bugzilla.mozilla.org/show_bug.cgi?id=1733395)) -- Officially support Python 3.10 - -## 4.1.1 (2021-09-28) - -- Update private import paths on Javascript / Typescript templates. ([bug 1702468](https://bugzilla.mozilla.org/show_bug.cgi?id=1702468)) - -## 4.1.0 (2021-09-16) - -- Add support for Node.js platform on Javascript / Typescript templates. ([bug 1728982](https://bugzilla.mozilla.org/show_bug.cgi?id=1728982)) - -## 4.0.0 (2021-08-20) - -- Add support for Text metric type ([#374](https://github.com/mozilla/glean_parser/pull/374)) -- Reserve the `default` ping name. It can't be used as a ping name, but it can be used in `send_in_pings` ([#376](https://github.com/mozilla/glean_parser/pull/376)) - -## 3.8.0 (2021-08-18) - -- Expose ping reasons enum on JavaScript / TypeScript templates. ([bug 1719136](https://bugzilla.mozilla.org/show_bug.cgi?id=1719136)) -- Define an interface with the allowed extras for each event on the TypeScript template. ([bug 1693487](https://bugzilla.mozilla.org/show_bug.cgi?id=1693487)) - -## 3.7.0 (2021-07-13) - -- New lint: Check for redundant words in ping names ([#355](https://github.com/mozilla/glean_parser/pull/355)) -- Add support for URL metric type ([#361](https://github.com/mozilla/glean_parser/pull/361)) - -## 3.6.0 (2021-06-11) - -- Add a command `data-review` to generate a skeleton Data Review Request for all metrics matching a supplied bug number. ([bug 1704541](https://bugzilla.mozilla.org/show_bug.cgi?id=1704541)) -- Enable custom distribution outside of GeckoView (`gecko_datapoint` becomes optional) - -## 3.5.0 (2021-06-03) - -- Transform generated folder into QML Module when building Javascript templates for the Qt platform. ([bug 1707896](https://bugzilla.mozilla.org/show_bug.cgi?id=1707896) - - 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 `qmldir` file exposing all generated files; - - Drop the `namespace` option for Javascript templates; - - Add a new `version` option for Javascript templates, required when building for Qt, which expected the Glean QML module version. - -## 3.4.0 (2021-05-28) - -- Add missing import for Kotlin code ([#339](https://github.com/mozilla/glean_parser/pull/339)) -- Use a plain Kotlin type in the generated interface implementation ([#339](https://github.com/mozilla/glean_parser/pull/339)) -- Generate additional generics for event metrics ([#339](https://github.com/mozilla/glean_parser/pull/339)) -- For Kotlin skip generating `GleanBuildInfo.kt` when requested (with `with_buildinfo=false`) ([#341](https://github.com/mozilla/glean_parser/pull/341)) - -## 3.3.2 (2021-05-18) - -- Fix another bug in the Swift code generation when generating extra keys ([#334](https://github.com/mozilla/glean_parser/pull/334)) - -## 3.3.1 (2021-05-18) - -- Fix Swift code generation bug for pings ([#333](https://github.com/mozilla/glean_parser/pull/333)) - -## 3.3.0 (2021-05-18) - -- Generate new event API construct ([#321](https://github.com/mozilla/glean_parser/pull/321)) - -## 3.2.0 (2021-04-28) - -- Add option to add extra introductory text to generated markdown ([#298](https://github.com/mozilla/glean_parser/pull/298)) -- Add support for Qt in Javascript templates ([bug 1706252](https://bugzilla.mozilla.org/show_bug.cgi?id=1706252)) - - Javascript templates will now accept the `platform` option. If this option is set to `qt` - the generated templates will be Qt compatible. Default value is `webext`. - -## 3.1.2 (2021-04-21) - -- BUGFIX: Remove the "DO NOT COMMIT" notice from the documentation. - -## 3.1.1 (2021-04-19) - -- Recommend to not commit as well as to not edit the generated files. ([bug 1706042](https://bugzilla.mozilla.org/show_bug.cgi?id=1706042)) -- BUGFIX: Include import statement for labeled metric subtypes in Javascript and Typescript templates. - -## 3.1.0 (2021-04-16) - -- Add support for labeled metric types in Javascript and Typescript templates. - -## 3.0.0 (2021-04-13) - -- Raise limit on number of statically-defined lables to 100. ([bug 1702263](https://bugzilla.mozilla.org/show_bug.cgi?id=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. - -## 2.5.0 (2021-02-23) - -- Add parser and object model support for `rate` metric type. ([bug 1645166](https://bugzilla.mozilla.org/show_bug.cgi?id=1645166)) -- Add parser and object model support for telemetry_mirror property. ([bug 1685406](https://bugzilla.mozilla.org/show_bug.cgi?id=1685406)) -- Update the Javascript template to match Glean.js expectations. ([bug 1693516](https://bugzilla.mozilla.org/show_bug.cgi?id=1693516)) - - 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](https://bugzilla.mozilla.org/show_bug.cgi?id=1692157)) - - The templates added generate metrics and pings code for Glean.js. - -## 2.4.0 (2021-02-18) - -- **Experimental:** `glean_parser` has a new subcommand `coverage` to 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 - `Metric` object in `defined_in["filepath"]`. - -## 2.3.0 (2021-02-17) - -- Leverage the `glean_namespace` to provide correct import when building for Javascript. - -## 2.2.0 (2021-02-11) - -- The Kotlin generator now generates static build information that can be passed - into `Glean.initialize` to avoid calling the package manager at runtime. - -## 2.1.0 (2021-02-10) - -- Add support for generating Javascript code. - - The templates added generate metrics and pings code for Glean.js. - -## 2.0.0 (2021-02-05) - -- New versions 2.0.0 of the `metrics.yaml` and `pings.yaml` schemas 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 - included `deletion_request`, `bookmarks_sync`, `history_sync`, - `session_end`, `all_pings`, `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 `$schema` value with `2-0-0`. - -- **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. - -## 1.29.1 (2020-12-17) - -- BUGFIX: Linter output can now be redirected correctly (1675771). - -## 1.29.0 (2020-10-07) - -- **Breaking change:** `glean_parser` will now return an error code when any of - the input files do not exist (unless the `--allow-missing-files` flag is - passed). -- Generated code now includes a comment next to each metric containing the name - of the metric in its original `snake_case` form. -- When metrics don't provide a `unit` parameter, it is not included in the - output (as provided by probe-scraper). - -## 1.28.6 (2020-09-24) - -- BUGFIX: Ensure Kotlin arguments are deterministically ordered - -## 1.28.5 (2020-09-14) - -- Fix deploy step to update pip before deploying to pypi. - -## 1.28.4 (2020-09-14) - -- The `SUPERFLUOUS_NO_LINT` warning has been removed from the glinter. - It likely did more harm than good, and makes it hard to make - `metrics.yaml` files that pass across different versions of - `glean_parser`. -- Expired metrics will now produce a linter warning, `EXPIRED_METRIC`. -- Expiry dates that are more than 730 days (\~2 years) in the future - will produce a linter warning, `EXPIRATION_DATE_TOO_FAR`. -- Allow using the Quantity metric type outside of Gecko. -- New parser configs `custom_is_expired` and `custom_validate_expires` - added. These are both functions that take the `expires` value of the - metric and return a bool. (See `Metric.is_expired` and - `Metric.validate_expires`). These will allow FOG to provide custom - validation for its version-based `expires` values. - -## 1.28.3 (2020-07-28) - -- BUGFIX: Support HashSet and Dictionary in the C\## generated code. - -## 1.28.2 (2020-07-28) - -- BUGFIX: Generate valid C\## code when using Labeled metric types. - -## 1.28.1 (2020-07-24) - -- BUGFIX: Add missing column to correctly render markdown tables in generated - documentation. - -## 1.28.0 (2020-07-23) - -- **Breaking change:** The internal ping `deletion-request` was 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 `deletion_request` in any `send_in_pings` to `deletion-request` - after updating. - -## 1.27.0 (2020-07-21) - -- Rename the `data_category` field to `data_sensitivity` to be clearer. - -## 1.26.0 (2020-07-21) - -- Add support for JWE metric types. -- Add a `data_sensitivity` field to all metrics for specifying the type of data - collected in the field. - -## 1.25.0 (2020-07-17) - -- Add support for generating C\## code. -- BUGFIX: The memory unit is now correctly passed to the MemoryDistribution - metric type in Swift. - -## 1.24.0 (2020-06-30) - -- BUGFIX: look for metrics in send\_if\_empty pings. Metrics for these kinds of - pings were being ignored. - -## 1.23.0 (2020-06-27) - -- 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 . - -## 1.22.0 (2020-05-28) - -- **Breaking change:** (Swift only) Combine all metrics and pings into a single - generated file `Metrics.swift`. - -## 1.21.0 (2020-05-25) - -- `glinter` messages have been improved with more details and to be more - actionable. -- A maximum of 10 `extra_keys` is now enforced for `event` metric types. -- BUGFIX: the `Lifetime` enum values now match the values of the implementation - in mozilla/glean. - -## 1.20.4 (2020-05-07) - -- BUGFIX: yamllint errors are now reported using the correct file name. - -## 1.20.3 (2020-05-06) - -- Support for using `timing_distribution`'s `time_unit` parameter to control - the range of acceptable values is documented. The default unit for this use - case is `nanosecond` to avoid creating a breaking change. See [bug - 1630997](https://bugzilla.mozilla.org/show_bug.cgi?id=1630997) for more - information. - -## 1.20.2 (2020-04-24) - -- Dependencies that depend on the version of Python being used are now specified - using the [Declaring platform specific dependencies syntax in - setuptools](https://setuptools.readthedocs.io/en/latest/setuptools.html##declaring-platform-specific-dependencies). - 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. - -## 1.20.1 (2020-04-21) - -- 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. - -## 1.20.0 (2020-04-15) - -- **Breaking change:** glinter errors found during the `translate` command will - now return an error code. glinter warnings will be displayed, but not return - an error code. -- `glean_parser` now produces a linter warning when `user` lifetime metrics are - set to expire. See [bug - 1604854](https://bugzilla.mozilla.org/show_bug.cgi?id=1604854) for additional - context. - -## 1.19.0 (2020-03-18) - -- **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_parser` now makes it easier to write external translation - functions for different language targets. -- BUGFIX: `glean_parser` now works on 32-bit Windows. - -## 1.18.3 (2020-02-24) - -- Dropped the `inflection` dependency. -- Constrained the `zipp` and `MarkupSafe` transitive dependencies to versions - that support Python 3.5. - -## 1.18.2 (2020-02-14) - -- BUGFIX: Fix rendering of first element of reason list. - -## 1.18.1 (2020-02-14) - -- 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 `@JvmName` annotation isn't - added to private members. - -## 1.18.0 (2020-02-13) - -- **Breaking Change (Java API)** Have the metrics names in Java match the names - in Kotlin. See [Bug - 1588060](https://bugzilla.mozilla.org/show_bug.cgi?id=1588060). -- The reasons a ping are sent are now included in the generated markdown - documentation. - -## 1.17.3 (2020-02-05) - -- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no - longer supports Python 3.5. - -## 1.17.2 (2020-02-05) - -- BUGFIX: Fixes an import error in generated Kotlin code. - -## 1.17.1 (2020-02-05) - -- BUGFIX: Generated Swift code now includes `import Glean`, unless generating - for a Glean-internal build. - -## 1.17.0 (2020-02-03) - -- Remove default schema URL from `validate_ping` -- Make `schema` argument required for CLI -- BUGFIX: Avoid default import in Swift code for Glean itself -- BUGFIX: Restore order of fields in generated Swift code - -## 1.16.0 (2020-01-15) - -- Support for `reason` codes on pings was added. - -## 1.15.6 (2020-02-06) - -- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no - longer supports Python 3.5 (backported from 1.17.3). - -## 1.15.5 (2019-12-19) - -- BUGFIX: Also allow the legacy name `all_pings` for `send_in_pings` parameter - on metrics - -## 1.15.4 (2019-12-19) - -- BUGFIX: Also allow the legacy name `all_pings` - -## 1.15.3 (2019-12-13) - -- Add project title to markdown template. -- Remove "Sorry about that" from markdown template. -- BUGFIX: Replace dashes in variable names to force proper naming - -## 1.15.2 (2019-12-12) - -- BUGFIX: Use a pure Python library for iso8601 so there is no compilation - required. - -## 1.15.1 (2019-12-12) - -- BUGFIX: Add some additional ping names to the non-kebab-case allow list. - -## 1.15.0 (2019-12-12) - -- Restrict new pings names to be kebab-case and change `all_pings` to - `all-pings` - -## 1.14.0 (2019-12-06) - -- `glean_parser` now supports Python versions 3.5, 3.6, 3.7 and 3.8. - -## 1.13.0 (2019-12-04) - -- The `translate` command 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 - -## 1.12.0 (2019-11-27) - -- Reserve the `deletion_request` ping name -- Added a new flag `send_if_empty` for pings - -## 1.11.0 (2019-11-13) - -- The `glinter` command now performs `yamllint` validation on registry files. - -## 1.10.0 (2019-11-11) - -- The Kotlin linter `detekt` is 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 - `tox` for this doesn't work in modern versions of CircleCI, so the - `tox` configuration has been removed. -- `yamllint` has 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 `enumeration`, `rate`, `usage`, and - `use_counter`, as well as many labeled metrics that don't exist. - -## 1.9.5 (2019-10-22) - -- Allow a Swift lint for generated code -- New lint: Restrict what metric can go into the `baseline` ping -- New lint: Warn for slight misspellings in ping names -- BUGFIX: change Labeled types labels from lists to sets. - -## 1.9.4 (2019-10-16) - -- Use lists instead of sets in Labeled types labels to ensure that the order of - the labels passed to the `metrics.yaml` is kept. -- `glinter` will now check for duplicate labels and error if there are any. - -## 1.9.3 (2019-10-09) - -- Add labels from Labeled types to the Extra column in the Markdown template. - -## 1.9.2 (2019-10-08) - -- BUGFIX: Don't call `is_internal_metric` on `Ping` objects. - -## 1.9.1 (2019-10-07) - -- Don't include Glean internal metrics in the generated markdown. - -## 1.9.0 (2019-10-04) - -- Glinter now warns when bug numbers (rather than URLs) are used. -- BUGFIX: add `HistogramType` and `MemoryUnit` imports in Kotlin generated code. - -## 1.8.4 (2019-10-02) - -- Removed unsupported labeled metric types. - -## 1.8.3 (2019-10-02) - -- Fix indentation for generated Swift code - -## 1.8.2 (2019-10-01) - -- Created labeled metrics and events in Swift code and wrap it in a - configured namespace - -## 1.8.1 (2019-09-27) - -- BUGFIX: `memory_unit` is now passed to the Kotlin generator. - -## 1.8.0 (2019-09-26) - -- 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 `metrics.yaml` - file. -- `glinter` will now report about superfluous `no_lint` entries. - -## 1.7.0 (2019-09-24) - -- A `glinter` tool is now included to find common mistakes in metric naming - and setup. This check is run during `translate` and warnings will be - displayed. ⚠ These warnings will be treated as errors in a future revision. - -## 1.6.1 (2019-09-17) - -- BUGFIX: `GleanGeckoMetricsMapping` must include `LabeledMetricType` - and `CounterMetricType`. - -## 1.6.0 (2019-09-17) - -- NEW: Support for outputting metrics in Swift. -- BUGFIX: Provides a helpful error message when `geckoview_datapoint` is used on - an metric type that doesn't support GeckoView exfiltration. -- Generate a lookup table for Gecko categorical histograms in - `GleanGeckoMetricsMapping`. -- Introduce a 'Swift' output generator. - -## 1.4.1 (2019-08-28) - -- Documentation only. - -## 1.4.0 (2019-08-27) - -- Added support for generating markdown documentation from `metrics.yaml` files. - -## 1.3.0 (2019-08-22) - -- `quantity` metric type has been added. - -## 1.2.1 (2019-08-13) - -- BUGFIX: `includeClientId` was not being output for PingType. - -## 1.2.0 (2019-08-13) - -- `memory_distribution` metric type has been added. -- `custom_distribution` metric type has been added. -- `labeled_timespan` is no longer an allowed metric type. - -## 1.1.0 (2019-08-05) - -- Add a special `all_pings` value to `send_in_pings`. - -## 1.0.0 (2019-07-29) - -- First release to start following strict semver. - -## 0.1.0 (2018-10-15) - -- First release on PyPI. diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/RECORD b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/RECORD deleted file mode 100644 index 417484d30b..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/RECORD +++ /dev/null @@ -1,44 +0,0 @@ -glean_parser/__init__.py,sha256=bJljD052_0y-efcBhYpllICVCXOMHLcXRLNyrvfgt5A,533 -glean_parser/__main__.py,sha256=Rw0PpuQtAvdHJMK1YLozeZkc6x1yjeNZwidu4faovdk,8633 -glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405 -glean_parser/data_review.py,sha256=BweeeTkNNS6HrIDkztawhbDByrk_-Avxpg7YeST3VAs,2152 -glean_parser/javascript.py,sha256=w4ZhNBHBKWYk0h3t7G0Ud2tR__hRqzn9dlEXNKLdQrA,11230 -glean_parser/javascript_server.py,sha256=SDV9tPL1uZMyS1VSyo5lOFuNPFHZu-PZxr1vhND-GzM,7971 -glean_parser/kotlin.py,sha256=5z8_74xlqvHDsedwZhGf1_qb7swPEgIZumkJIuj3ef8,12598 -glean_parser/lint.py,sha256=STqdgyOhR4Q3fHivSizgn9bOOyqrNHhzjaqyJxz6qzI,19948 -glean_parser/markdown.py,sha256=GkCr1CrV6mnRQseT6FO1-JJ7Eup8X3lxUfRMBTxXpe4,9066 -glean_parser/metrics.py,sha256=uWOJdZRB9udMni2EWXcL3P1T4pRIlJ5kiE5fJsHkmdU,12450 -glean_parser/parser.py,sha256=cUOnvSXKfEBg8YTpRcWiPcMwpFpK1TTqsVO_zjUtpR4,15309 -glean_parser/pings.py,sha256=la9HdJTjtSqC7vc5-JuANW0otbozTnFARlIMgKoypGU,2982 -glean_parser/ruby_server.py,sha256=-bNXjfXWwHWUHmLJVvfi6jCyw8q0MBwx9VXVWQ3bU-A,5189 -glean_parser/rust.py,sha256=PJzTfYWzAumJYCP5IYPc6fhS_Qa30Q8NTK9plg3sDnk,6744 -glean_parser/swift.py,sha256=T1BSGahd9wUd6VDeNC89SdN6M34jKXDlydMpSI0QLOs,8379 -glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391 -glean_parser/translate.py,sha256=C7FY7AAbnVsPZOu2bKELW1CfTwnvLGpmgzY7uMDqOec,8233 -glean_parser/translation_options.py,sha256=Lxzr6G7MP0tC_ZYlZXftS4j0SLiqO-5mGVTEc7ggXis,2037 -glean_parser/util.py,sha256=X5YFAU4kWdDJjMsJzXH-QJVSjUJc_qvXktiM-dJSfzo,16004 -glean_parser/validate_ping.py,sha256=0TNvILH6dtzJDys3W8Kqorw6kk03me73OCUDtpoHcXU,2118 -glean_parser/schemas/metrics.1-0-0.schema.yaml,sha256=cND3cvi6iBfPUVmtfIBQfGJV9AALpbvN7nu8E33_J-o,19566 -glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=sfrARxefWy1WN5HxUKjwjN8lGobbPds5l7Y46VHfP1g,25849 -glean_parser/schemas/pings.1-0-0.schema.yaml,sha256=hwCnsKpEysmrmVp-QHGBArEkVY3vaU1rVsxlTwhAzws,4315 -glean_parser/schemas/pings.2-0-0.schema.yaml,sha256=l-nIuyXJ9-D0X_U6hzGVbhIBhtZDg-rGau-RDrhgpng,4705 -glean_parser/schemas/tags.1-0-0.schema.yaml,sha256=OGXIJlvvVW1vaqB_NVZnwKeZ-sLlfH57vjBSHbj6DNI,1231 -glean_parser/templates/data_review.jinja2,sha256=jeYU29T1zLSyu9fKBBFu5BFPfIw8_hmOUXw8RXhRXK8,3287 -glean_parser/templates/javascript.buildinfo.jinja2,sha256=4mXiZCQIk9if4lxlA05kpSIL4a95IdwGwqle2OqqNAs,474 -glean_parser/templates/javascript.jinja2,sha256=cT_bG-jC6m4afECXmcsqHwiiHjRuVtJnfv90OD2Mwxw,2669 -glean_parser/templates/javascript_server.jinja2,sha256=H991yQOKJMwSgM0bLEA-Q5Z15LWsfEPh6bTYz_owSCU,9423 -glean_parser/templates/kotlin.buildinfo.jinja2,sha256=X0lk2SNu5OIIj2i6mUyF9CWFQIonLgfqkgT5fA-5G6c,920 -glean_parser/templates/kotlin.geckoview.jinja2,sha256=MJOgtoDXmBjE9pwk-G6T89y36RZuMbDWM_-DBN_gFJo,5099 -glean_parser/templates/kotlin.jinja2,sha256=3DqUMXJRkmTvSp_5IRyvGmw5iXYWdox7coMFe3YDxcc,5247 -glean_parser/templates/markdown.jinja2,sha256=vAHHGGm28HRDPd3zO_wQMAUZIuxE9uQ7hl3NpXxcKV4,3425 -glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156 -glean_parser/templates/ruby_server.jinja2,sha256=vm4BEenOqzomQNTLFfMOzlWHARnsWUjTBbnR-v2cadI,6247 -glean_parser/templates/rust.jinja2,sha256=pdbjq_JGm8XWHsVXk0m2xZ5Pd-Y9T_zxJfZKBoT0ERU,3635 -glean_parser/templates/swift.jinja2,sha256=NfZdvrG8LGT4H2AWk-vB_GDTMcpW1XZJcApO4OF5AYE,4874 -glean_parser-11.0.1.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455 -glean_parser-11.0.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725 -glean_parser-11.0.1.dist-info/METADATA,sha256=z5yLEYgY4EV1e_cHNQhenhkwK5ryURgljfTfaYK-NYs,30877 -glean_parser-11.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92 -glean_parser-11.0.1.dist-info/entry_points.txt,sha256=mf9d3sv8BwSjjR58x9KDnpVkONCnv3fPQC2NjJl15Xg,68 -glean_parser-11.0.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13 -glean_parser-11.0.1.dist-info/RECORD,, diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/WHEEL b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/WHEEL deleted file mode 100644 index 98c0d20b7a..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.42.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/entry_points.txt b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/entry_points.txt deleted file mode 100644 index 08fde9d655..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -glean_parser = glean_parser.__main__:main_wrapper diff --git a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/top_level.txt b/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/top_level.txt deleted file mode 100644 index a7f3a37918..0000000000 --- a/third_party/python/glean_parser/glean_parser-11.0.1.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -glean_parser diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/AUTHORS.md b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/AUTHORS.md new file mode 100644 index 0000000000..525116ee7e --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/AUTHORS.md @@ -0,0 +1,17 @@ +# Credits + +## Development Lead + +- Jan-Erik Rediger +- Alessio Placitelli + +## Contributors + +See [the full list of contributors](https://github.com/mozilla/glean_parser/graphs/contributors). + +## Acknowledgements + +This package was created with +[Cookiecutter](https://github.com/audreyr/cookiecutter) and the +[audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) +project template. diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/LICENSE b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/LICENSE new file mode 100644 index 0000000000..a612ad9813 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/METADATA b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/METADATA new file mode 100644 index 0000000000..1e31df3dd4 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/METADATA @@ -0,0 +1,786 @@ +Metadata-Version: 2.1 +Name: glean-parser +Version: 13.0.0 +Summary: Parser tools for Mozilla's Glean telemetry +Home-page: https://github.com/mozilla/glean_parser +Author: The Glean Team +Author-email: glean-team@mozilla.com +Keywords: glean_parser +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Description-Content-Type: text/markdown +License-File: LICENSE +License-File: AUTHORS.md +Requires-Dist: appdirs >=1.4 +Requires-Dist: Click >=7 +Requires-Dist: diskcache >=4 +Requires-Dist: Jinja2 >=2.10.1 +Requires-Dist: jsonschema >=3.0.2 +Requires-Dist: PyYAML >=5.3.1 + +# Glean Parser + +Parser tools for Mozilla's Glean telemetry. + +## Features + +Contains various utilities for handling `metrics.yaml` and `pings.yaml` for [the +Glean SDKs](https://mozilla.github.io/glean). This includes producing generated +code for various integrations, linting and coverage testing. + +## Documentation + +- [How to Contribute](https://github.com/mozilla/glean_parser/blob/main/CONTRIBUTING.md). Please file bugs in [bugzilla](https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&bug_ignored=0&bug_severity=normal&bug_status=NEW&cf_fission_milestone=---&cf_fx_iteration=---&cf_fx_points=---&cf_status_firefox65=---&cf_status_firefox66=---&cf_status_firefox67=---&cf_status_firefox_esr60=---&cf_status_thunderbird_esr60=---&cf_tracking_firefox65=---&cf_tracking_firefox66=---&cf_tracking_firefox67=---&cf_tracking_firefox_esr60=---&cf_tracking_firefox_relnote=---&cf_tracking_thunderbird_esr60=---&product=Data%20Platform%20and%20Tools&component=Glean%3A%20SDK&contenttypemethod=list&contenttypeselection=text%2Fplain&defined_groups=1&flag_type-203=X&flag_type-37=X&flag_type-41=X&flag_type-607=X&flag_type-721=X&flag_type-737=X&flag_type-787=X&flag_type-799=X&flag_type-800=X&flag_type-803=X&flag_type-835=X&flag_type-846=X&flag_type-855=X&flag_type-864=X&flag_type-916=X&flag_type-929=X&flag_type-930=X&flag_type-935=X&flag_type-936=X&flag_type-937=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Unspecified&priority=P3&&rep_platform=Unspecified&status_whiteboard=%5Btelemetry%3Aglean-rs%3Am%3F%5D&target_milestone=---&version=unspecified). +- [User documentation for Glean](https://mozilla.github.io/glean/). +- [`glean_parser` developer documentation](https://mozilla.github.io/glean_parser/). + +## Requirements + +- Python 3.8 (or later) + +The following library requirements are installed automatically when +`glean_parser` is installed by `pip`. + +- appdirs +- Click +- diskcache +- Jinja2 +- jsonschema +- PyYAML + +## Usage + +```sh +$ glean_parser --help +``` + +Read in `metrics.yaml`, translate to Kotlin format, and +output to `output_dir`: + +```sh +$ glean_parser translate -o output_dir -f kotlin metrics.yaml +``` + +Check a Glean ping against the ping schema: + +```sh +$ glean_parser check < ping.json +``` + + +# Changelog + +## Unreleased + +## 13.0.0 + +- BREAKING CHANGE: Support metadata field `include_info_sections` ([bug 1866559](https://bugzilla.mozilla.org/show_bug.cgi?id=1866559)) + +## 12.0.1 + +- Fix Rust codegen for object metric type ([#662](https://github.com/mozilla/glean_parser/pull/662)) + +## 12.0.0 + +- Add new metric type object (only Rust codegen support right now) ([#587](https://github.com/mozilla/glean_parser/pull/587)) + +## 11.1.0 + +- Add Go log outputter (`go_server`) ([#645](https://github.com/mozilla/glean_parser/pull/645)) +- Add Python log outputter (`python_server`) ([MPP-3642](https://mozilla-hub.atlassian.net/browse/MPP-3642)) + +## 11.0.1 + +- Fix javascript_server template to include non-event metric parameters in #record call for event metrics ([#643](https://github.com/mozilla/glean_parser/pull/643)) +- events: Increase extra key limit to 50 ([Bug 1869429](https://bugzilla.mozilla.org/show_bug.cgi?id=1869429)) + +## 11.0.0 + +- Add updated logging logic for Ruby Server ([#642](https://github.com/mozilla/glean_parser/pull/642)) +- Add support for event metric type in server-side JavaScript outputter ([DENG-1736](https://mozilla-hub.atlassian.net/browse/DENG-1736)) +- BREAKING CHANGE: Dropped support for Python 3.7 ([#638](https://github.com/mozilla/glean_parser/pull/638)) +- Add official support for Python 3.11+ ([#638](https://github.com/mozilla/glean_parser/pull/638)) + +## 10.0.3 + +- Warn about empty or TODO-tagged data reviews in the list ([#634](https://github.com/mozilla/glean_parser/pull/634)) +- Allow `unit` field on all metrics, but warn for all but quantity and custom distribution ([#636](https://github.com/mozilla/glean_parser/pull/636)) + +## 10.0.2 + +- Allow `unit` field for string again, but warn about it in the linter ([#634](https://github.com/mozilla/glean_parser/pull/634)) + +## 10.0.1 + +- Allow `unit` field for custom distribution again ([#633](https://github.com/mozilla/glean_parser/pull/633)) + +## 10.0.0 + +- Add Ruby log outputter (`ruby_server`) ([#620](https://github.com/mozilla/glean_parser/pull/620)) +- BREAKING CHANE: `ping` lifetime metrics on the events ping are now disallowed ([#625](https://github.com/mozilla/glean_parser/pull/625)) +- Disallow `unit` field for anything but quantity ([#630](https://github.com/mozilla/glean_parser/pull/630)). + Note that this was already considered the case, now the code enforces it. + +## 9.0.0 + +- BREAKING CHANGE: Dropped support for Python 3.6 ([#615](https://github.com/mozilla/glean_parser/issues/615)) +- Allow metadata to configure precise timestamps in pings ([#592](https://github.com/mozilla/glean_parser/pull/592)) + +## 8.1.1 + +- Small updates to the `javascript_server` tempalte to address lint warnings ([#598](https://github.com/mozilla/glean_parser/pull/598)) + +## 8.1.0 + +- Increased the maximum metric name length in version 2.0.0 schema ([#596](https://github.com/mozilla/glean_parser/pull/596)) + +## 8.0.0 + +- BREAKING CHANGE: Remove exposed `lint_yaml_files` function ([#580](https://github.com/mozilla/glean_parser/pull/580)) +- Rust: Removed `__glean_metric_maps` from the Rust Jinja template. This functionality is better placed downstream ([Bug 1816526](https://bugzilla.mozilla.org/show_bug.cgi?id=1816526)) +- New lint: check that all referenced pings are known ([#584](https://github.com/mozilla/glean_parser/pull/584)) +- Add experimental server-side JavaScript outputter ([FXA-7922](https://mozilla-hub.atlassian.net/browse/FXA-7922)) + +## 7.2.1 + +- Unbreak last minor release ([#579](https://github.com/mozilla/glean_parser/pull/579)) + +## 7.2.0 + +- Remove yamllint integration ([#578](https://github.com/mozilla/glean_parser/pull/578)) + +## 7.1.0 + +- ENHANCEMENT: Labels in `labels:` fields may now contain any printable ASCII characters ([bug 1672273](https://bugzilla.mozilla.org/show_bug.cgi?id=1672273)) +- BUGFIX: Enforce ordering of generation of Pings, Metrics and Tags such that order is deterministic ([bug 1820334](https://bugzilla.mozilla.org/show_bug.cgi?id=1820334)) + +## 7.0.0 + +- BUGFIX: Remove internal-only fields from serialized metrics data ([#550](https://github.com/mozilla/glean_parser/pull/550)) +- FEATURE: New subcommand: `dump` to dump the metrics data as JSON ([#550](https://github.com/mozilla/glean_parser/pull/550)) +- BUGFIX: Kotlin: Generate enums with the right generic bound for ping reason codes ([#551](https://github.com/mozilla/glean_parser/pull/551)). +- **BREAKING CHANGE:** Fully remove support for the old events API ([#549](https://github.com/mozilla/glean_parser/pull/549)) + Adds a new lint `OLD_EVENT_API` to warn about missing `type` attributes on event extra keys. + Note that the Glean SDK already dropped support for the old events API. + +## 6.4.0 + +- BUGFIX: Correct code generation for labeled metrics in Rust ([#533](https://github.com/mozilla/glean_parser/pull/533)) +- BUGFIX: Correctly serialize `Rates` for Rust code ([#530](https://github.com/mozilla/glean_parser/pull/530)) +- Feature: Wrap labeled metric's static labels list as CoW strings (requires updated Glean support) ([#534](https://github.com/mozilla/glean_parser/pull/534)) + +## 6.3.0 + +- events: Increase extras limit to 15 ([bug 1798713](https://bugzilla.mozilla.org/show_bug.cgi?id=1798713)) + +## 6.2.1 + +- Add support for Rate, Denominator and Numerator metrics for JavaScript. ([bug 1793777](https://bugzilla.mozilla.org/show_bug.cgi?id=1793777)) + +## 6.2.0 + +- [data-review] Use a template to generate the Data Review Request template ([bug 1772605](https://bugzilla.mozilla.org/show_bug.cgi?id=1772605)) +- Make tag and no\_lint order deterministic ([#518](https://github.com/mozilla/glean_parser/pull/518)) + +## 6.1.2 + +- Swift: Add a conditional `import Foundation` to support generating metrics when Glean is delivered via the AppServices iOS megazord + +## 6.1.1 + +- Rust: Use correct name for a ping in generated code. + +## 6.1.0 + +- [data-review] Include extra keys' names and descriptions in data review template ([bug 1767027](https://bugzilla.mozilla.org/show_bug.cgi?id=1767027)) +- Raise limit on number of statically-defined labels to 4096. ([bug 1772163](https://bugzilla.mozilla.org/show_bug.cgi?id=1772163)) +- Fix Rust code generation for new UniFFI interface ([#491](https://github.com/mozilla/glean_parser/pull/491), [#494](https://github.com/mozilla/glean_parser/pull/494), [#495](https://github.com/mozilla/glean_parser/pull/495)) + +## 6.0.1 + +- Relax version requirement for MarkupSafe. + Now works with MarkupSafe v1.1.1 to v2.0.1 inclusive again. + +## 6.0.0 + +- BUGFIX: Add missing `extra_args` to Rust constructor generation ([bug 1765855](https://bugzilla.mozilla.org/show_bug.cgi?id=1765855)) +- **Breaking change:** `glean_parser` now 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 +- Explicitly skip Rate, Denominator and Numerator metrics for JavaScript. + These will cause a build failure by default, but can be turned into warnings on request. + Use `-s fail_rates=false` to enable warning-only mode. + +## 5.1.2 + +- BUGFIX: Revert changes made on v5.1.1. + - The issues addressed by those changes, were non-issues and result of misuse of the APIs. + +## 5.1.1 + +- BUGFIX: Fix issues with Swift templates ([bug 1749494](https://bugzilla.mozilla.org/show_bug.cgi?id=1749494)) + - Make metrics and pings all `public` + - Make pings `static` + +## 5.1.0 + +- Add support for build info generation for JavaScript and Typescript targets ([bug 1749494](https://bugzilla.mozilla.org/show_bug.cgi?id=1749494)) + +## 5.0.1 + +- Fix the logic for the metric expiration by version ([bug 1753194](https://bugzilla.mozilla.org/show_bug.cgi?id=1753194)) + +## 5.0.0 + +- Remove C# support ([#436](https://github.com/mozilla/glean_parser/pull/436)). +- Add support for Rust code generation ([bug 1677434](https://bugzilla.mozilla.org/show_bug.cgi?id=1677434)) +- Report an error if no files are passed ([bug 1751730](https://bugzilla.mozilla.org/show_bug.cgi?id=1751730)) +- [data-review] Report an error if no metrics match provided bug number ([bug 1752576](https://bugzilla.mozilla.org/show_bug.cgi?id=1752576)) +- [data-review] Include notification_emails in list of those responsible ([bug 1752576](https://bugzilla.mozilla.org/show_bug.cgi?id=1752576)) +- Add support for expiring metrics by the provided major version ([bug 1753194](https://bugzilla.mozilla.org/show_bug.cgi?id=1753194)) + +## 4.4.0 + +- Support global file-level tags in metrics.yaml ([bug 1745283](https://bugzilla.mozilla.org/show_bug.cgi?id=1745283)) +- Glinter: Reject metric files if they use `unit` by mistake. It should be `time_unit` ([#432](https://github.com/mozilla/glean_parser/pull/432)). +- Automatically generate a build date when generating build info ([#431](https://github.com/mozilla/glean_parser/pull/431)). + Enabled for Kotlin and Swift. + This can be changed with the `build_date` command line option. + `build_date=0` will use a static unix epoch time. + `build_date=2022-01-03T17:30:00` will parse the ISO8601 string to use (as a UTC timestamp). + Other values will throw an error. + + Example: + + glean_parser translate --format kotlin --option build_date=2021-11-01T01:00:00 path/to/metrics.yaml + +## 4.3.1 + +- BUGFIX: Skip tags for code generation ([#409](https://github.com/mozilla/glean_parser/pull/409)) + +## 4.3.0 + +- Support tags in glean parser ([bug 1734011](https://bugzilla.mozilla.org/show_bug.cgi?id=1734011)) + +## 4.2.0 + +- Improve the schema validation error messages. They will no longer include `OrderedDict(...)` on Python 3.7 and later ([bug 1733395](https://bugzilla.mozilla.org/show_bug.cgi?id=1733395)) +- Officially support Python 3.10 + +## 4.1.1 (2021-09-28) + +- Update private import paths on Javascript / Typescript templates. ([bug 1702468](https://bugzilla.mozilla.org/show_bug.cgi?id=1702468)) + +## 4.1.0 (2021-09-16) + +- Add support for Node.js platform on Javascript / Typescript templates. ([bug 1728982](https://bugzilla.mozilla.org/show_bug.cgi?id=1728982)) + +## 4.0.0 (2021-08-20) + +- Add support for Text metric type ([#374](https://github.com/mozilla/glean_parser/pull/374)) +- Reserve the `default` ping name. It can't be used as a ping name, but it can be used in `send_in_pings` ([#376](https://github.com/mozilla/glean_parser/pull/376)) + +## 3.8.0 (2021-08-18) + +- Expose ping reasons enum on JavaScript / TypeScript templates. ([bug 1719136](https://bugzilla.mozilla.org/show_bug.cgi?id=1719136)) +- Define an interface with the allowed extras for each event on the TypeScript template. ([bug 1693487](https://bugzilla.mozilla.org/show_bug.cgi?id=1693487)) + +## 3.7.0 (2021-07-13) + +- New lint: Check for redundant words in ping names ([#355](https://github.com/mozilla/glean_parser/pull/355)) +- Add support for URL metric type ([#361](https://github.com/mozilla/glean_parser/pull/361)) + +## 3.6.0 (2021-06-11) + +- Add a command `data-review` to generate a skeleton Data Review Request for all metrics matching a supplied bug number. ([bug 1704541](https://bugzilla.mozilla.org/show_bug.cgi?id=1704541)) +- Enable custom distribution outside of GeckoView (`gecko_datapoint` becomes optional) + +## 3.5.0 (2021-06-03) + +- Transform generated folder into QML Module when building Javascript templates for the Qt platform. ([bug 1707896](https://bugzilla.mozilla.org/show_bug.cgi?id=1707896) + - 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 `qmldir` file exposing all generated files; + - Drop the `namespace` option for Javascript templates; + - Add a new `version` option for Javascript templates, required when building for Qt, which expected the Glean QML module version. + +## 3.4.0 (2021-05-28) + +- Add missing import for Kotlin code ([#339](https://github.com/mozilla/glean_parser/pull/339)) +- Use a plain Kotlin type in the generated interface implementation ([#339](https://github.com/mozilla/glean_parser/pull/339)) +- Generate additional generics for event metrics ([#339](https://github.com/mozilla/glean_parser/pull/339)) +- For Kotlin skip generating `GleanBuildInfo.kt` when requested (with `with_buildinfo=false`) ([#341](https://github.com/mozilla/glean_parser/pull/341)) + +## 3.3.2 (2021-05-18) + +- Fix another bug in the Swift code generation when generating extra keys ([#334](https://github.com/mozilla/glean_parser/pull/334)) + +## 3.3.1 (2021-05-18) + +- Fix Swift code generation bug for pings ([#333](https://github.com/mozilla/glean_parser/pull/333)) + +## 3.3.0 (2021-05-18) + +- Generate new event API construct ([#321](https://github.com/mozilla/glean_parser/pull/321)) + +## 3.2.0 (2021-04-28) + +- Add option to add extra introductory text to generated markdown ([#298](https://github.com/mozilla/glean_parser/pull/298)) +- Add support for Qt in Javascript templates ([bug 1706252](https://bugzilla.mozilla.org/show_bug.cgi?id=1706252)) + - Javascript templates will now accept the `platform` option. If this option is set to `qt` + the generated templates will be Qt compatible. Default value is `webext`. + +## 3.1.2 (2021-04-21) + +- BUGFIX: Remove the "DO NOT COMMIT" notice from the documentation. + +## 3.1.1 (2021-04-19) + +- Recommend to not commit as well as to not edit the generated files. ([bug 1706042](https://bugzilla.mozilla.org/show_bug.cgi?id=1706042)) +- BUGFIX: Include import statement for labeled metric subtypes in Javascript and Typescript templates. + +## 3.1.0 (2021-04-16) + +- Add support for labeled metric types in Javascript and Typescript templates. + +## 3.0.0 (2021-04-13) + +- Raise limit on number of statically-defined lables to 100. ([bug 1702263](https://bugzilla.mozilla.org/show_bug.cgi?id=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. + +## 2.5.0 (2021-02-23) + +- Add parser and object model support for `rate` metric type. ([bug 1645166](https://bugzilla.mozilla.org/show_bug.cgi?id=1645166)) +- Add parser and object model support for telemetry_mirror property. ([bug 1685406](https://bugzilla.mozilla.org/show_bug.cgi?id=1685406)) +- Update the Javascript template to match Glean.js expectations. ([bug 1693516](https://bugzilla.mozilla.org/show_bug.cgi?id=1693516)) + - 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](https://bugzilla.mozilla.org/show_bug.cgi?id=1692157)) + - The templates added generate metrics and pings code for Glean.js. + +## 2.4.0 (2021-02-18) + +- **Experimental:** `glean_parser` has a new subcommand `coverage` to 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 + `Metric` object in `defined_in["filepath"]`. + +## 2.3.0 (2021-02-17) + +- Leverage the `glean_namespace` to provide correct import when building for Javascript. + +## 2.2.0 (2021-02-11) + +- The Kotlin generator now generates static build information that can be passed + into `Glean.initialize` to avoid calling the package manager at runtime. + +## 2.1.0 (2021-02-10) + +- Add support for generating Javascript code. + - The templates added generate metrics and pings code for Glean.js. + +## 2.0.0 (2021-02-05) + +- New versions 2.0.0 of the `metrics.yaml` and `pings.yaml` schemas 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 + included `deletion_request`, `bookmarks_sync`, `history_sync`, + `session_end`, `all_pings`, `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 `$schema` value with `2-0-0`. + +- **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. + +## 1.29.1 (2020-12-17) + +- BUGFIX: Linter output can now be redirected correctly (1675771). + +## 1.29.0 (2020-10-07) + +- **Breaking change:** `glean_parser` will now return an error code when any of + the input files do not exist (unless the `--allow-missing-files` flag is + passed). +- Generated code now includes a comment next to each metric containing the name + of the metric in its original `snake_case` form. +- When metrics don't provide a `unit` parameter, it is not included in the + output (as provided by probe-scraper). + +## 1.28.6 (2020-09-24) + +- BUGFIX: Ensure Kotlin arguments are deterministically ordered + +## 1.28.5 (2020-09-14) + +- Fix deploy step to update pip before deploying to pypi. + +## 1.28.4 (2020-09-14) + +- The `SUPERFLUOUS_NO_LINT` warning has been removed from the glinter. + It likely did more harm than good, and makes it hard to make + `metrics.yaml` files that pass across different versions of + `glean_parser`. +- Expired metrics will now produce a linter warning, `EXPIRED_METRIC`. +- Expiry dates that are more than 730 days (\~2 years) in the future + will produce a linter warning, `EXPIRATION_DATE_TOO_FAR`. +- Allow using the Quantity metric type outside of Gecko. +- New parser configs `custom_is_expired` and `custom_validate_expires` + added. These are both functions that take the `expires` value of the + metric and return a bool. (See `Metric.is_expired` and + `Metric.validate_expires`). These will allow FOG to provide custom + validation for its version-based `expires` values. + +## 1.28.3 (2020-07-28) + +- BUGFIX: Support HashSet and Dictionary in the C\## generated code. + +## 1.28.2 (2020-07-28) + +- BUGFIX: Generate valid C\## code when using Labeled metric types. + +## 1.28.1 (2020-07-24) + +- BUGFIX: Add missing column to correctly render markdown tables in generated + documentation. + +## 1.28.0 (2020-07-23) + +- **Breaking change:** The internal ping `deletion-request` was 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 `deletion_request` in any `send_in_pings` to `deletion-request` + after updating. + +## 1.27.0 (2020-07-21) + +- Rename the `data_category` field to `data_sensitivity` to be clearer. + +## 1.26.0 (2020-07-21) + +- Add support for JWE metric types. +- Add a `data_sensitivity` field to all metrics for specifying the type of data + collected in the field. + +## 1.25.0 (2020-07-17) + +- Add support for generating C\## code. +- BUGFIX: The memory unit is now correctly passed to the MemoryDistribution + metric type in Swift. + +## 1.24.0 (2020-06-30) + +- BUGFIX: look for metrics in send\_if\_empty pings. Metrics for these kinds of + pings were being ignored. + +## 1.23.0 (2020-06-27) + +- 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 . + +## 1.22.0 (2020-05-28) + +- **Breaking change:** (Swift only) Combine all metrics and pings into a single + generated file `Metrics.swift`. + +## 1.21.0 (2020-05-25) + +- `glinter` messages have been improved with more details and to be more + actionable. +- A maximum of 10 `extra_keys` is now enforced for `event` metric types. +- BUGFIX: the `Lifetime` enum values now match the values of the implementation + in mozilla/glean. + +## 1.20.4 (2020-05-07) + +- BUGFIX: yamllint errors are now reported using the correct file name. + +## 1.20.3 (2020-05-06) + +- Support for using `timing_distribution`'s `time_unit` parameter to control + the range of acceptable values is documented. The default unit for this use + case is `nanosecond` to avoid creating a breaking change. See [bug + 1630997](https://bugzilla.mozilla.org/show_bug.cgi?id=1630997) for more + information. + +## 1.20.2 (2020-04-24) + +- Dependencies that depend on the version of Python being used are now specified + using the [Declaring platform specific dependencies syntax in + setuptools](https://setuptools.readthedocs.io/en/latest/setuptools.html##declaring-platform-specific-dependencies). + 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. + +## 1.20.1 (2020-04-21) + +- 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. + +## 1.20.0 (2020-04-15) + +- **Breaking change:** glinter errors found during the `translate` command will + now return an error code. glinter warnings will be displayed, but not return + an error code. +- `glean_parser` now produces a linter warning when `user` lifetime metrics are + set to expire. See [bug + 1604854](https://bugzilla.mozilla.org/show_bug.cgi?id=1604854) for additional + context. + +## 1.19.0 (2020-03-18) + +- **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_parser` now makes it easier to write external translation + functions for different language targets. +- BUGFIX: `glean_parser` now works on 32-bit Windows. + +## 1.18.3 (2020-02-24) + +- Dropped the `inflection` dependency. +- Constrained the `zipp` and `MarkupSafe` transitive dependencies to versions + that support Python 3.5. + +## 1.18.2 (2020-02-14) + +- BUGFIX: Fix rendering of first element of reason list. + +## 1.18.1 (2020-02-14) + +- 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 `@JvmName` annotation isn't + added to private members. + +## 1.18.0 (2020-02-13) + +- **Breaking Change (Java API)** Have the metrics names in Java match the names + in Kotlin. See [Bug + 1588060](https://bugzilla.mozilla.org/show_bug.cgi?id=1588060). +- The reasons a ping are sent are now included in the generated markdown + documentation. + +## 1.17.3 (2020-02-05) + +- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no + longer supports Python 3.5. + +## 1.17.2 (2020-02-05) + +- BUGFIX: Fixes an import error in generated Kotlin code. + +## 1.17.1 (2020-02-05) + +- BUGFIX: Generated Swift code now includes `import Glean`, unless generating + for a Glean-internal build. + +## 1.17.0 (2020-02-03) + +- Remove default schema URL from `validate_ping` +- Make `schema` argument required for CLI +- BUGFIX: Avoid default import in Swift code for Glean itself +- BUGFIX: Restore order of fields in generated Swift code + +## 1.16.0 (2020-01-15) + +- Support for `reason` codes on pings was added. + +## 1.15.6 (2020-02-06) + +- BUGFIX: The version of Jinja2 now specifies < 3.0, since that version no + longer supports Python 3.5 (backported from 1.17.3). + +## 1.15.5 (2019-12-19) + +- BUGFIX: Also allow the legacy name `all_pings` for `send_in_pings` parameter + on metrics + +## 1.15.4 (2019-12-19) + +- BUGFIX: Also allow the legacy name `all_pings` + +## 1.15.3 (2019-12-13) + +- Add project title to markdown template. +- Remove "Sorry about that" from markdown template. +- BUGFIX: Replace dashes in variable names to force proper naming + +## 1.15.2 (2019-12-12) + +- BUGFIX: Use a pure Python library for iso8601 so there is no compilation + required. + +## 1.15.1 (2019-12-12) + +- BUGFIX: Add some additional ping names to the non-kebab-case allow list. + +## 1.15.0 (2019-12-12) + +- Restrict new pings names to be kebab-case and change `all_pings` to + `all-pings` + +## 1.14.0 (2019-12-06) + +- `glean_parser` now supports Python versions 3.5, 3.6, 3.7 and 3.8. + +## 1.13.0 (2019-12-04) + +- The `translate` command 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 + +## 1.12.0 (2019-11-27) + +- Reserve the `deletion_request` ping name +- Added a new flag `send_if_empty` for pings + +## 1.11.0 (2019-11-13) + +- The `glinter` command now performs `yamllint` validation on registry files. + +## 1.10.0 (2019-11-11) + +- The Kotlin linter `detekt` is 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 + `tox` for this doesn't work in modern versions of CircleCI, so the + `tox` configuration has been removed. +- `yamllint` has 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 `enumeration`, `rate`, `usage`, and + `use_counter`, as well as many labeled metrics that don't exist. + +## 1.9.5 (2019-10-22) + +- Allow a Swift lint for generated code +- New lint: Restrict what metric can go into the `baseline` ping +- New lint: Warn for slight misspellings in ping names +- BUGFIX: change Labeled types labels from lists to sets. + +## 1.9.4 (2019-10-16) + +- Use lists instead of sets in Labeled types labels to ensure that the order of + the labels passed to the `metrics.yaml` is kept. +- `glinter` will now check for duplicate labels and error if there are any. + +## 1.9.3 (2019-10-09) + +- Add labels from Labeled types to the Extra column in the Markdown template. + +## 1.9.2 (2019-10-08) + +- BUGFIX: Don't call `is_internal_metric` on `Ping` objects. + +## 1.9.1 (2019-10-07) + +- Don't include Glean internal metrics in the generated markdown. + +## 1.9.0 (2019-10-04) + +- Glinter now warns when bug numbers (rather than URLs) are used. +- BUGFIX: add `HistogramType` and `MemoryUnit` imports in Kotlin generated code. + +## 1.8.4 (2019-10-02) + +- Removed unsupported labeled metric types. + +## 1.8.3 (2019-10-02) + +- Fix indentation for generated Swift code + +## 1.8.2 (2019-10-01) + +- Created labeled metrics and events in Swift code and wrap it in a + configured namespace + +## 1.8.1 (2019-09-27) + +- BUGFIX: `memory_unit` is now passed to the Kotlin generator. + +## 1.8.0 (2019-09-26) + +- 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 `metrics.yaml` + file. +- `glinter` will now report about superfluous `no_lint` entries. + +## 1.7.0 (2019-09-24) + +- A `glinter` tool is now included to find common mistakes in metric naming + and setup. This check is run during `translate` and warnings will be + displayed. ⚠ These warnings will be treated as errors in a future revision. + +## 1.6.1 (2019-09-17) + +- BUGFIX: `GleanGeckoMetricsMapping` must include `LabeledMetricType` + and `CounterMetricType`. + +## 1.6.0 (2019-09-17) + +- NEW: Support for outputting metrics in Swift. +- BUGFIX: Provides a helpful error message when `geckoview_datapoint` is used on + an metric type that doesn't support GeckoView exfiltration. +- Generate a lookup table for Gecko categorical histograms in + `GleanGeckoMetricsMapping`. +- Introduce a 'Swift' output generator. + +## 1.4.1 (2019-08-28) + +- Documentation only. + +## 1.4.0 (2019-08-27) + +- Added support for generating markdown documentation from `metrics.yaml` files. + +## 1.3.0 (2019-08-22) + +- `quantity` metric type has been added. + +## 1.2.1 (2019-08-13) + +- BUGFIX: `includeClientId` was not being output for PingType. + +## 1.2.0 (2019-08-13) + +- `memory_distribution` metric type has been added. +- `custom_distribution` metric type has been added. +- `labeled_timespan` is no longer an allowed metric type. + +## 1.1.0 (2019-08-05) + +- Add a special `all_pings` value to `send_in_pings`. + +## 1.0.0 (2019-07-29) + +- First release to start following strict semver. + +## 0.1.0 (2018-10-15) + +- First release on PyPI. diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/RECORD b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/RECORD new file mode 100644 index 0000000000..62e4bb6fbb --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/RECORD @@ -0,0 +1,48 @@ +glean_parser/__init__.py,sha256=bJljD052_0y-efcBhYpllICVCXOMHLcXRLNyrvfgt5A,533 +glean_parser/__main__.py,sha256=Rw0PpuQtAvdHJMK1YLozeZkc6x1yjeNZwidu4faovdk,8633 +glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405 +glean_parser/data_review.py,sha256=BweeeTkNNS6HrIDkztawhbDByrk_-Avxpg7YeST3VAs,2152 +glean_parser/go_server.py,sha256=SCcGrjRktlPyl79LbjIvtBeCNYVOXOW4Q8xkuks0bzE,5345 +glean_parser/javascript.py,sha256=w4ZhNBHBKWYk0h3t7G0Ud2tR__hRqzn9dlEXNKLdQrA,11230 +glean_parser/javascript_server.py,sha256=SDV9tPL1uZMyS1VSyo5lOFuNPFHZu-PZxr1vhND-GzM,7971 +glean_parser/kotlin.py,sha256=5z8_74xlqvHDsedwZhGf1_qb7swPEgIZumkJIuj3ef8,12598 +glean_parser/lint.py,sha256=STqdgyOhR4Q3fHivSizgn9bOOyqrNHhzjaqyJxz6qzI,19948 +glean_parser/markdown.py,sha256=GkCr1CrV6mnRQseT6FO1-JJ7Eup8X3lxUfRMBTxXpe4,9066 +glean_parser/metrics.py,sha256=YAO8wPuRHTLkdT9M4zh9ZwoFI1_VS8O9oQqwZNYyDp0,14612 +glean_parser/parser.py,sha256=cUOnvSXKfEBg8YTpRcWiPcMwpFpK1TTqsVO_zjUtpR4,15309 +glean_parser/pings.py,sha256=AQ-fBmIx2GKQv6J2NyTFfHHZzSnApZZoC770LlstkoI,3180 +glean_parser/python_server.py,sha256=3ZsqeNJknKO9yvtBJWxe67JthzSMqNMuo9DfhgF2kvg,4790 +glean_parser/ruby_server.py,sha256=-bNXjfXWwHWUHmLJVvfi6jCyw8q0MBwx9VXVWQ3bU-A,5189 +glean_parser/rust.py,sha256=UEHeIZlToxCBelfec5sl_l_uLZfk8f_OUXqa_ZoEvnk,7330 +glean_parser/swift.py,sha256=T1BSGahd9wUd6VDeNC89SdN6M34jKXDlydMpSI0QLOs,8379 +glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391 +glean_parser/translate.py,sha256=luKQoraARZ2tjenHs0SVtCxflnYaMkzPYFfKEdKdSqQ,8403 +glean_parser/translation_options.py,sha256=Lxzr6G7MP0tC_ZYlZXftS4j0SLiqO-5mGVTEc7ggXis,2037 +glean_parser/util.py,sha256=KgvmjETOV1IIGD4hF_o5zcUDE-wp3SHxrNHM1niU0CM,16033 +glean_parser/validate_ping.py,sha256=0TNvILH6dtzJDys3W8Kqorw6kk03me73OCUDtpoHcXU,2118 +glean_parser/schemas/metrics.1-0-0.schema.yaml,sha256=cND3cvi6iBfPUVmtfIBQfGJV9AALpbvN7nu8E33_J-o,19566 +glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=wx1q0L4C0-Vcwk1SPU6t8OfjDEQvgrwwEG6xfSHO1MI,26365 +glean_parser/schemas/pings.1-0-0.schema.yaml,sha256=hwCnsKpEysmrmVp-QHGBArEkVY3vaU1rVsxlTwhAzws,4315 +glean_parser/schemas/pings.2-0-0.schema.yaml,sha256=vDyvFT8KwAwaqyWHG4y6pFNrsc3NO7OyDDagA2eTeqM,5415 +glean_parser/schemas/tags.1-0-0.schema.yaml,sha256=OGXIJlvvVW1vaqB_NVZnwKeZ-sLlfH57vjBSHbj6DNI,1231 +glean_parser/templates/data_review.jinja2,sha256=jeYU29T1zLSyu9fKBBFu5BFPfIw8_hmOUXw8RXhRXK8,3287 +glean_parser/templates/go_server.jinja2,sha256=Jy1e0uQqr_WZNoj-AWnygRmygX2jyj_GQMMV8mSah2k,6825 +glean_parser/templates/javascript.buildinfo.jinja2,sha256=4mXiZCQIk9if4lxlA05kpSIL4a95IdwGwqle2OqqNAs,474 +glean_parser/templates/javascript.jinja2,sha256=cT_bG-jC6m4afECXmcsqHwiiHjRuVtJnfv90OD2Mwxw,2669 +glean_parser/templates/javascript_server.jinja2,sha256=H991yQOKJMwSgM0bLEA-Q5Z15LWsfEPh6bTYz_owSCU,9423 +glean_parser/templates/kotlin.buildinfo.jinja2,sha256=X0lk2SNu5OIIj2i6mUyF9CWFQIonLgfqkgT5fA-5G6c,920 +glean_parser/templates/kotlin.geckoview.jinja2,sha256=MJOgtoDXmBjE9pwk-G6T89y36RZuMbDWM_-DBN_gFJo,5099 +glean_parser/templates/kotlin.jinja2,sha256=3DqUMXJRkmTvSp_5IRyvGmw5iXYWdox7coMFe3YDxcc,5247 +glean_parser/templates/markdown.jinja2,sha256=vAHHGGm28HRDPd3zO_wQMAUZIuxE9uQ7hl3NpXxcKV4,3425 +glean_parser/templates/python_server.jinja2,sha256=gu2C1rkn760IqBCG2SWaK7o32T1ify94wDEsudLPUg8,7260 +glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156 +glean_parser/templates/ruby_server.jinja2,sha256=vm4BEenOqzomQNTLFfMOzlWHARnsWUjTBbnR-v2cadI,6247 +glean_parser/templates/rust.jinja2,sha256=wlV0OZvV3Mk2ulrqFkN1vGjdsahsupEy2TQvWxQKzww,5439 +glean_parser/templates/swift.jinja2,sha256=xkvVsTpfK0QK3tI32wGqzxm2hqFNaBQ6Y71rKIsCmAI,4944 +glean_parser-13.0.0.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455 +glean_parser-13.0.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725 +glean_parser-13.0.0.dist-info/METADATA,sha256=BzYfW5GF-wZLrokfvUTiZg7JT5BTfB1E3xIDKW6h_BY,31493 +glean_parser-13.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92 +glean_parser-13.0.0.dist-info/entry_points.txt,sha256=mf9d3sv8BwSjjR58x9KDnpVkONCnv3fPQC2NjJl15Xg,68 +glean_parser-13.0.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13 +glean_parser-13.0.0.dist-info/RECORD,, diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/WHEEL b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/WHEEL new file mode 100644 index 0000000000..98c0d20b7a --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.42.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/entry_points.txt b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/entry_points.txt new file mode 100644 index 0000000000..08fde9d655 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +glean_parser = glean_parser.__main__:main_wrapper diff --git a/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/top_level.txt b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/top_level.txt new file mode 100644 index 0000000000..a7f3a37918 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser-13.0.0.dist-info/top_level.txt @@ -0,0 +1 @@ +glean_parser diff --git a/third_party/python/glean_parser/glean_parser/go_server.py b/third_party/python/glean_parser/glean_parser/go_server.py new file mode 100644 index 0000000000..403a0d71f4 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/go_server.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +""" +Outputter to generate server Go code for collecting events. + +This outputter is different from the rest of the outputters in that the code it +generates does not use the Glean SDK. It is meant to be used to collect events +in server-side environments. In these environments SDK assumptions to measurement +window and connectivity don't hold. +Generated code takes care of assembling pings with metrics, and serializing to messages +conforming to Glean schema. + +Warning: this outputter supports limited set of metrics, +see `SUPPORTED_METRIC_TYPES` below. + +The generated code creates the following: +* Two methods for logging an Event metric + one with and one without user request info specified +""" +from collections import defaultdict +from pathlib import Path +from typing import Any, Dict, Optional, List + +from . import __version__ +from . import metrics +from . import util + +# Adding a metric here will require updating the `generate_metric_type` function +# and require adjustments to `metrics` variables the the template. +SUPPORTED_METRIC_TYPES = ["string", "quantity", "event"] + + +def generate_event_type_name(metric: metrics.Metric) -> str: + return f"Event{util.Camelize(metric.category)}{util.Camelize(metric.name)}" + + +def generate_metric_name(metric: metrics.Metric) -> str: + return f"{metric.category}.{metric.name}" + + +def generate_extra_name(extra: str) -> str: + return util.Camelize(extra) + + +def generate_metric_argument_name(metric: metrics.Metric) -> str: + return f"{util.Camelize(metric.category)}{util.Camelize(metric.name)}" + + +def generate_metric_type(metric_type: str) -> str: + if metric_type == "quantity": + return "int64" + elif metric_type == "string": + return "string" + elif metric_type == "boolean": + return "bool" + else: + print("❌ Unable to generate Go type from metric type: " + metric_type) + exit + return "NONE" + + +def clean_string(s: str) -> str: + return s.replace("\n", " ").rstrip() + + +def output_go( + objs: metrics.ObjectTree, output_dir: Path, options: Optional[Dict[str, Any]] +) -> None: + """ + Given a tree of objects, output Go code to `output_dir`. + + The output is a single file containing all the code for assembling pings with + metrics, serializing, and submitting. + + :param objects: A tree of objects (metrics and pings) as returned from + `parser.parse_objects`. + :param output_dir: Path to an output directory to write to. + """ + + template = util.get_jinja2_template( + "go_server.jinja2", + filters=( + ("event_type_name", generate_event_type_name), + ("event_extra_name", generate_extra_name), + ("metric_name", generate_metric_name), + ("metric_argument_name", generate_metric_argument_name), + ("go_metric_type", generate_metric_type), + ("clean_string", clean_string), + ), + ) + + PING_METRIC_ERROR_MSG = ( + " Server-side environment is simplified and only supports the events ping type." + + " You should not be including pings.yaml with your parser call" + + " or referencing any other pings in your metric configuration." + ) + if "pings" in objs: + print("❌ Ping definition found." + PING_METRIC_ERROR_MSG) + return + + # Go through all metrics in objs and build a map of + # ping->list of metric categories->list of metrics + # for easier processing in the template. + ping_to_metrics: Dict[str, Dict[str, List[metrics.Metric]]] = defaultdict(dict) + for _category_key, category_val in objs.items(): + for _metric_name, metric in category_val.items(): + if isinstance(metric, metrics.Metric): + if metric.type not in SUPPORTED_METRIC_TYPES: + print( + "❌ Ignoring unsupported metric type: " + + f"{metric.type}:{metric.name}." + + " Reach out to Glean team to add support for this" + + " metric type." + ) + continue + for ping in metric.send_in_pings: + if ping != "events": + ( + print( + "❌ Non-events ping reference found." + + PING_METRIC_ERROR_MSG + + f"Ignoring the {ping} ping type." + ) + ) + continue + metrics_by_type = ping_to_metrics[ping] + metrics_list = metrics_by_type.setdefault(metric.type, []) + metrics_list.append(metric) + + if "event" not in ping_to_metrics["events"]: + print("❌ No event metrics found...at least one event metric is required") + return + + extension = ".go" + filepath = output_dir / ("server_events" + extension) + with filepath.open("w", encoding="utf-8") as fd: + fd.write( + template.render( + parser_version=__version__, events_ping=ping_to_metrics["events"] + ) + ) diff --git a/third_party/python/glean_parser/glean_parser/metrics.py b/third_party/python/glean_parser/glean_parser/metrics.py index 5738239f97..accfbd763d 100644 --- a/third_party/python/glean_parser/glean_parser/metrics.py +++ b/third_party/python/glean_parser/glean_parser/metrics.py @@ -181,6 +181,7 @@ class Metric: d.pop("unit") d.pop("_config", None) d.pop("_generate_enums", None) + d.pop("_generate_structure", None) return d def _serialize_input(self) -> Dict[str, util.JSONType]: @@ -434,4 +435,63 @@ class Text(Metric): typename = "text" +class Object(Metric): + typename = "object" + + def __init__(self, *args, **kwargs): + structure = kwargs.pop("structure", None) + if not structure: + raise ValueError("`object` is missing required parameter `structure`") + + self._generate_structure = self.validate_structure(structure) + super().__init__(*args, **kwargs) + + ALLOWED_TOPLEVEL = {"type", "properties", "items"} + ALLOWED_TYPES = ["object", "array", "number", "string", "boolean"] + + @staticmethod + def _validate_substructure(structure): + extra = set(structure.keys()) - Object.ALLOWED_TOPLEVEL + if extra: + extra = ", ".join(extra) + allowed = ", ".join(Object.ALLOWED_TOPLEVEL) + raise ValueError( + f"Found additional fields: {extra}. Only allowed: {allowed}" + ) + + if "type" not in structure or structure["type"] not in Object.ALLOWED_TYPES: + raise ValueError("invalid or missing `type` in object structure") + + if structure["type"] == "object": + if "items" in structure: + raise ValueError("`items` not allowed in object structure") + + if "properties" not in structure: + raise ValueError("`properties` missing for type `object`") + + for key in structure["properties"]: + value = structure["properties"][key] + structure["properties"][key] = Object._validate_substructure(value) + + if structure["type"] == "array": + if "properties" in structure: + raise ValueError("`properties` not allowed in array structure") + + if "items" not in structure: + raise ValueError("`items` missing for type `array`") + + value = structure["items"] + structure["items"] = Object._validate_substructure(value) + + return structure + + @staticmethod + def validate_structure(structure): + if None: + raise ValueError("`structure` needed for object metric.") + + structure = Object._validate_substructure(structure) + return structure + + ObjectTree = Dict[str, Dict[str, Union[Metric, pings.Ping, tags.Tag]]] diff --git a/third_party/python/glean_parser/glean_parser/pings.py b/third_party/python/glean_parser/glean_parser/pings.py index 3099fa1d16..b4145ea68d 100644 --- a/third_party/python/glean_parser/glean_parser/pings.py +++ b/third_party/python/glean_parser/glean_parser/pings.py @@ -45,6 +45,7 @@ class Ping: metadata = {} self.metadata = metadata self.precise_timestamps = self.metadata.get("precise_timestamps", True) + self.include_info_sections = self.metadata.get("include_info_sections", True) if data_reviews is None: data_reviews = [] self.data_reviews = data_reviews @@ -90,6 +91,9 @@ class Ping: d = self.serialize() modified_dict = util.remove_output_params(d, "defined_in") modified_dict = util.remove_output_params(modified_dict, "precise_timestamps") + modified_dict = util.remove_output_params( + modified_dict, "include_info_sections" + ) return modified_dict def identifier(self) -> str: diff --git a/third_party/python/glean_parser/glean_parser/python_server.py b/third_party/python/glean_parser/glean_parser/python_server.py new file mode 100644 index 0000000000..8ead0eb315 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/python_server.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +""" +Outputter to generate server Python code for collecting events. + +This outputter is different from the rest of the outputters in that the code it +generates does not use the Glean SDK. It is meant to be used to collect events +in server-side environments. In these environments SDK assumptions to measurement +window and connectivity don't hold. +Generated code takes care of assembling pings with metrics, and serializing to messages +conforming to Glean schema. + +Warning: this outputter supports limited set of metrics, +see `SUPPORTED_METRIC_TYPES` below. + +The generated code creates a `ServerEventLogger` class for each ping that has +at least one event metric. The class has a `record` method for each event metric. +""" +from collections import defaultdict +from pathlib import Path +from typing import Any, Dict, Optional, List + +from . import __version__ +from . import metrics +from . import util + +# Adding a metric here will require updating the `generate_metric_type` function +# and require adjustments to `metrics` variables the the template. +SUPPORTED_METRIC_TYPES = ["string", "quantity", "event"] + + +def camelize(s: str) -> str: + return util.Camelize(s) + + +def generate_metric_type(metric_type: str) -> str: + if metric_type == "quantity": + return "int" + elif metric_type == "string": + return "str" + elif metric_type == "boolean": + return "bool" + else: + print("❌ Unable to generate Python type from metric type: " + metric_type) + exit + return "NONE" + + +def clean_string(s: str) -> str: + return s.replace("\n", " ").rstrip() + + +def generate_ping_factory_method(ping: str) -> str: + return f"create_{util.snake_case(ping)}_server_event_logger" + + +def generate_event_record_function_name(event_metric: metrics.Metric) -> str: + return ( + f"record_{util.snake_case(event_metric.category)}_" + + f"{util.snake_case(event_metric.name)}" + ) + + +def output_python( + objs: metrics.ObjectTree, output_dir: Path, options: Optional[Dict[str, Any]] +) -> None: + """ + Given a tree of objects, output Python code to `output_dir`. + + The output is a file containing all the code for assembling pings with + metrics, serializing, and submitting, and an empty `__init__.py` file to + make the directory a package. + + :param objects: A tree of objects (metrics and pings) as returned from + `parser.parse_objects`. + :param output_dir: Path to an output directory to write to. + """ + + template = util.get_jinja2_template( + "python_server.jinja2", + filters=( + ("camelize", camelize), + ("py_metric_type", generate_metric_type), + ("clean_string", clean_string), + ("factory_method", generate_ping_factory_method), + ("record_event_function_name", generate_event_record_function_name), + ), + ) + + # Go through all metrics in objs and build a map of + # ping->list of metric categories->list of metrics + # for easier processing in the template. + ping_to_metrics: Dict[str, Dict[str, List[metrics.Metric]]] = defaultdict(dict) + for _category_key, category_val in objs.items(): + for _metric_name, metric in category_val.items(): + if isinstance(metric, metrics.Metric): + if metric.type not in SUPPORTED_METRIC_TYPES: + print( + "❌ Ignoring unsupported metric type: " + + f"{metric.type}:{metric.name}." + + " Reach out to Glean team to add support for this" + + " metric type." + ) + continue + for ping in metric.send_in_pings: + metrics_by_type = ping_to_metrics[ping] + metrics_list = metrics_by_type.setdefault(metric.type, []) + metrics_list.append(metric) + + for ping, metrics_by_type in ping_to_metrics.items(): + if "event" not in metrics_by_type: + print( + f"❌ No event metrics found for ping: {ping}." + + " At least one event metric is required." + ) + return + + extension = ".py" + filepath = output_dir / ("server_events" + extension) + with filepath.open("w", encoding="utf-8") as fd: + fd.write(template.render(parser_version=__version__, pings=ping_to_metrics)) + + # create an empty `__init__.py` file to make the directory a package + init_file = output_dir / "__init__.py" + with init_file.open("w", encoding="utf-8") as fd: + fd.write("") diff --git a/third_party/python/glean_parser/glean_parser/rust.py b/third_party/python/glean_parser/glean_parser/rust.py index eb3355e382..6dd4426d84 100644 --- a/third_party/python/glean_parser/glean_parser/rust.py +++ b/third_party/python/glean_parser/glean_parser/rust.py @@ -65,7 +65,7 @@ def rust_datatypes_filter(value): elif isinstance(value, metrics.CowString): yield f'::std::borrow::Cow::from("{value.inner}")' elif isinstance(value, str): - yield f'"{value}".into()' + yield f"{json.dumps(value)}.into()" elif isinstance(value, metrics.Rate): yield "CommonMetricData(" first = True @@ -115,6 +115,11 @@ def type_name(obj): return "{}<{}>".format(class_name(obj.type), generic) + generate_structure = getattr(obj, "_generate_structure", []) + if len(generate_structure): + generic = util.Camelize(obj.name) + "Object" + return "{}<{}>".format(class_name(obj.type), generic) + return class_name(obj.type) @@ -133,6 +138,21 @@ def extra_type_name(typ: str) -> str: return "UNSUPPORTED" +def structure_type_name(typ: str) -> str: + """ + Returns the corresponding Rust type for structure items. + """ + + if typ == "boolean": + return "bool" + elif typ == "string": + return "String" + elif typ == "number": + return "i64" + else: + return "UNSUPPORTED" + + def class_name(obj_type): """ Returns the Rust class name for a given metric or ping type. @@ -190,6 +210,7 @@ def output_rust( ("camelize", util.camelize), ("type_name", type_name), ("extra_type_name", extra_type_name), + ("structure_type_name", structure_type_name), ("ctor", ctor), ("extra_keys", extra_keys), ), diff --git a/third_party/python/glean_parser/glean_parser/schemas/metrics.2-0-0.schema.yaml b/third_party/python/glean_parser/glean_parser/schemas/metrics.2-0-0.schema.yaml index 0bc8d500c6..0e785c5303 100644 --- a/third_party/python/glean_parser/glean_parser/schemas/metrics.2-0-0.schema.yaml +++ b/third_party/python/glean_parser/glean_parser/schemas/metrics.2-0-0.schema.yaml @@ -119,6 +119,9 @@ definitions: - `text`: Record long text data. + - `object`: Record structured data based on a pre-defined schema + Additional properties: `structure`. + type: string enum: - event @@ -140,6 +143,7 @@ definitions: - labeled_counter - rate - text + - object description: title: Description @@ -567,6 +571,15 @@ definitions: so glean_parser can find it. type: string + structure: + title: A subset of a JSON schema definition + description: | + The expected structure of data, defined in a strict subset of + YAML-dialect JSON Schema (Draft 7) supporting keys "type" + (only values "object", "array", "number", "string", and "boolean"), + "properties", and "items". + type: object + required: - type - bugs diff --git a/third_party/python/glean_parser/glean_parser/schemas/pings.2-0-0.schema.yaml b/third_party/python/glean_parser/glean_parser/schemas/pings.2-0-0.schema.yaml index 2f25405d45..6679a8066b 100644 --- a/third_party/python/glean_parser/glean_parser/schemas/pings.2-0-0.schema.yaml +++ b/third_party/python/glean_parser/glean_parser/schemas/pings.2-0-0.schema.yaml @@ -84,6 +84,18 @@ additionalProperties: When `false` Glean uses minute-precise timestamps for the ping's start/end time. type: boolean + include_info_sections: + title: Include Info Sections + description: | + When `true`, assemble and include the `client_info` and `ping_info` + sections in the ping on submission. + When `false`, omit the `client_info` and `ping_info` sections when + assembling the ping on submission. + Defaults to `true`. + + Interaction with `include_client_id`: `include_client_id` only takes + effect when `metadata.include_info_sections` is `true`. + type: boolean default: {} @@ -93,6 +105,9 @@ additionalProperties: **Required.** When `true`, include the `client_id` value in the ping. + + Interaction with `metadata.include_info_sections`: `include_client_id` + only takes effect when `metadata.include_info_sections` is `true`. type: boolean send_if_empty: diff --git a/third_party/python/glean_parser/glean_parser/templates/go_server.jinja2 b/third_party/python/glean_parser/glean_parser/templates/go_server.jinja2 new file mode 100644 index 0000000000..0a26831b0f --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/templates/go_server.jinja2 @@ -0,0 +1,225 @@ +{# The final Go code is autogenerated, but this template is not. Please file bugs! #} +package glean + +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// AUTOGENERATED BY glean_parser v{{ parser_version }}. DO NOT EDIT. + +// required imports +import ( + "encoding/json" + "fmt" + "strconv" + "time" + + "github.com/google/uuid" +) + +// log type string used to identify logs to process in the Moz Data Pipeline +var gleanEventMozlogType string = "glean-server-event" + +type GleanEventsLogger struct { + AppID string // Application Id to identify application per Glean standards + AppDisplayVersion string // Version of application emitting the event + AppChannel string // Channel to differentiate logs from prod/beta/staging/devel +} + +// exported type for public method parameters +type RequestInfo struct { + UserAgent string + IpAddress string +} + +// default empty values will be omitted in json from ping struct definition +var defaultRequestInfo = RequestInfo{ + UserAgent: "", + IpAddress: "", +} + +// structs to construct the glean ping +type clientInfo struct { + TelemetrySDKBuild string `json:"telemetry_sdk_build"` + FirstRunDate string `json:"first_run_date"` + OS string `json:"os"` + OSVersion string `json:"os_version"` + Architecture string `json:"architecture"` + AppBuild string `json:"app_build"` + AppDisplayVersion string `json:"app_display_version"` + AppChannel string `json:"app_channel"` +} + +type pingInfo struct { + Seq int `json:"seq"` + StartTime string `json:"start_time"` + EndTime string `json:"end_time"` +} + +type ping struct { + DocumentNamespace string `json:"document_namespace"` + DocumentType string `json:"document_type"` + DocumentVersion string `json:"document_version"` + DocumentID string `json:"document_id"` + UserAgent string `json:"user_agent,omitempty"` + IpAddress string `json:"ip_address,omitempty"` + Payload string `json:"payload"` +} + +type metrics map[string]map[string]interface{} + +type pingPayload struct { + ClientInfo clientInfo `json:"client_info"` + PingInfo pingInfo `json:"ping_info"` + Metrics metrics `json:"metrics"` + Events []gleanEvent `json:"events"` +} + +type gleanEvent struct { + Category string `json:"category"` + Name string `json:"name"` + Timestamp int64 `json:"timestamp"` + Extra map[string]string `json:"extra"` +} + +type logEnvelope struct { + Timestamp string + Logger string + Type string + Fields ping +} + +func (g GleanEventsLogger) createClientInfo() clientInfo { + // Fields with default values are required in the Glean schema, but not used in server context + return clientInfo{ + TelemetrySDKBuild: "glean_parser v{{ parser_version }}", + FirstRunDate: "Unknown", + OS: "Unknown", + OSVersion: "Unknown", + Architecture: "Unknown", + AppBuild: "Unknown", + AppDisplayVersion: g.AppDisplayVersion, + AppChannel: g.AppChannel, + } +} + +func createPingInfo() pingInfo { + {# times are ISO-8601 strings, e.g. "2023-12-19T22:09:17.440Z" #} + var now = time.Now().UTC().Format("2006-01-02T15:04:05.000Z") + return pingInfo{ + Seq: 0, + StartTime: now, + EndTime: now, + } +} + +func (g GleanEventsLogger) createPing(documentType string, config RequestInfo, payload pingPayload) ping { + var payloadJson, payloadErr = json.Marshal(payload) + if payloadErr != nil { + panic("Unable to marshal payload to json") + } + var documentId = uuid.New() + return ping{ + DocumentNamespace: g.AppID, + DocumentType: documentType, + DocumentVersion: "1", + DocumentID: documentId.String(), + UserAgent: config.UserAgent, + IpAddress: config.IpAddress, + Payload: string(payloadJson), + } +} + +// method called by each event method. +// construct the ping, wrap it in the envelope, and print to stdout +func (g GleanEventsLogger) record( + documentType string, + requestInfo RequestInfo, + metrics metrics, + events []gleanEvent, +) { + var telemetryPayload = pingPayload{ + ClientInfo: g.createClientInfo(), + PingInfo: createPingInfo(), + Metrics: metrics, + Events: events, + } + + var ping = g.createPing(documentType, requestInfo, telemetryPayload) + + var envelope = logEnvelope{ + Timestamp: strconv.FormatInt(time.Now().UnixNano(), 10), + Logger: "glean", + Type: gleanEventMozlogType, + Fields: ping, + } + var envelopeJson, envelopeErr = json.Marshal(envelope) + if envelopeErr != nil { + panic("Unable to marshal log envelope to json") + } + fmt.Println(string(envelopeJson)) +} + +{% for event in events_ping["event"] %} +type {{ event|event_type_name }} struct { + {% for metric_type, metrics in events_ping.items() %} + {% if metric_type != 'event' %} + {% for metric in metrics %} + {{ metric|metric_argument_name }} {{ metric.type|go_metric_type }} // {{ metric.description|clean_string }} + {% endfor %} + {% endif %} + {% endfor %} + {% for extra, metadata in event.extra_keys.items() %} + {{ extra|event_extra_name }} {{ metadata.type|go_metric_type }} // {{ metadata.description|clean_string }} + {% endfor %} +} + +// Record and submit an {{ event|event_type_name }} event. +// {{ event.description|clean_string }} +func (g GleanEventsLogger) Record{{ event|event_type_name }}( + requestInfo RequestInfo, + params {{ event|event_type_name }}, +) { + var metrics = metrics{ + {% for metric_type, metrics in events_ping.items() %} + {% if metric_type != 'event' %} + "{{ metric_type }}": { + {% for metric in metrics %} + "{{ metric|metric_name }}": params.{{ metric|metric_argument_name }}, + {% endfor %} + }, + {% endif %} + {% endfor %} + } + var extraKeys = map[string]string{ + {% for extra, metadata in event.extra_keys.items() %} + {# convert all extra fields to string for submission #} + {% if metadata.type == 'boolean' %} + "{{ extra }}": fmt.Sprintf("%t", params.{{ extra|event_extra_name }}), + {% elif metadata.type == 'quantity' %} + "{{ extra }}": fmt.Sprintf("%d", params.{{ extra|event_extra_name }}), + {% else %} + "{{ extra }}": params.{{ extra|event_extra_name }}, + {% endif %} + {% endfor %} + } + var events = []gleanEvent{ + gleanEvent{ + Category: "{{ event.category }}", + Name: "{{ event.name }}", + Timestamp: time.Now().UnixMilli(), + Extra: extraKeys, + }, + } + g.record("events", requestInfo, metrics, events) +} + +// Record and submit an {{ event|event_type_name }} event omitting user request info +// {{ event.description|clean_string }} +func (g GleanEventsLogger) Record{{ event|event_type_name }}WithoutUserInfo( + params {{ event|event_type_name }}, +) { + g.Record{{ event|event_type_name }}(defaultRequestInfo, params) +} + +{% endfor %} diff --git a/third_party/python/glean_parser/glean_parser/templates/python_server.jinja2 b/third_party/python/glean_parser/glean_parser/templates/python_server.jinja2 new file mode 100644 index 0000000000..689fab2109 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/templates/python_server.jinja2 @@ -0,0 +1,194 @@ +{# The final Go code is autogenerated, but this template is not. Please file bugs! #} +""" +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +AUTOGENERATED BY glean_parser v{{ parser_version }}. DO NOT EDIT. DO NOT COMMIT. +""" + +from __future__ import annotations +from datetime import datetime, timezone +from typing import Any +from uuid import uuid4 +import json + +GLEAN_EVENT_MOZLOG_TYPE = "glean-server-event" + + +{% for ping, metrics_by_type in pings.items() %} +class {{ ping|camelize }}ServerEventLogger: + def __init__( + self, application_id: str, app_display_version: str, channel: str + ) -> None: + """ + Create {{ ping|camelize }}ServerEventLogger instance. + + :param str application_id: The application ID. + :param str app_display_version: The application display version. + :param str channel: The channel. + """ + self._application_id = application_id + self._app_display_version = app_display_version + self._channel = channel + + def _record( + self, + user_agent: str, + ip_address: str, + {% for metric_type, metrics in metrics_by_type.items() %} + {% if metric_type != 'event' %} + {% for metric in metrics %} + {{ metric.category }}_{{ metric.name }}: {{ metric.type|py_metric_type }}, + {% endfor %} + {% endif %} + {% endfor %} + event: dict[str, Any] + ) -> None: + now = datetime.now(timezone.utc) + timestamp = now.isoformat() + event["timestamp"] = int(1000.0 * now.timestamp()) # Milliseconds since epoch + event_payload = { + "metrics": { + {% for metric_type, metrics in metrics_by_type.items() %} + {% if metric_type != 'event' %} + "{{ metric_type }}": { + {% for metric in metrics %} + "{{ metric.category }}.{{ metric.name }}": {{ metric.category }}_{{ metric.name }}, + {% endfor %} + }, + {% endif %} + {% endfor %} + }, + "events": [event], + "ping_info": { + # seq is required in the Glean schema, however is not useful in server context + "seq": 0, + "start_time": timestamp, + "end_time": timestamp, + }, + # `Unknown` fields below are required in the Glean schema, however they are + # not useful in server context + "client_info": { + "telemetry_sdk_build": "glean_parser v{{ parser_version }}", + "first_run_date": "Unknown", + "os": "Unknown", + "os_version": "Unknown", + "architecture": "Unknown", + "app_build": "Unknown", + "app_display_version": self._app_display_version, + "app_channel": self._channel, + }, + } + event_payload_serialized = json.dumps(event_payload) + + # This is the message structure that Decoder expects: + # https://github.com/mozilla/gcp-ingestion/pull/2400 + ping = { + "document_namespace": self._application_id, + "document_type": "{{ ping }}", + "document_version": "1", + "document_id": str(uuid4()), + "user_agent": user_agent, + "ip_address": ip_address, + "payload": event_payload_serialized, + } + + + self.emit_record(now, ping) + + def emit_record(self, now: datetime, ping:dict[str, Any]) -> None: + """Log the ping to STDOUT. + Applications might want to override this method to use their own logging. + If doing so, make sure to log the ping as JSON, and to include the + `Type: GLEAN_EVENT_MOZLOG_TYPE`.""" + ping_envelope = { + "Timestamp": now.isoformat(), + "Logger": "glean", + "Type": GLEAN_EVENT_MOZLOG_TYPE, + "Fields": ping, + } + ping_envelope_serialized = json.dumps(ping_envelope) + + print(ping_envelope_serialized) + + {% for event in metrics_by_type["event"] %} + def {{ event|record_event_function_name }}( + self, + user_agent: str, + ip_address: str, + {% for metric_type, metrics in metrics_by_type.items() %} + {% if metric_type != 'event' %} + {% for metric in metrics %} + {{ metric.category }}_{{ metric.name }}: {{ metric.type|py_metric_type }}, + {% endfor %} + {% endif %} + {% endfor %} + {% for extra, metadata in event.extra_keys.items() %} + {{ extra }}: {{ metadata.type|py_metric_type }}, + {% endfor %} + ) -> None: + """ + Record and submit a {{ event.category }}_{{ event.name }} event: + {{ event.description|clean_string }} + Event is logged to STDOUT via `print`. + + :param str user_agent: The user agent. + :param str ip_address: The IP address. Will be used to decode Geo information + and scrubbed at ingestion. + {% for metric_type, metrics in metrics_by_type.items() %} + {% if metric_type != 'event' %} + {% for metric in metrics %} + :param {{ metric.type|py_metric_type }} {{ metric.category }}_{{ metric.name }}: {{ metric.description|clean_string }} + {% endfor %} + {% endif %} + {% endfor %} + {% if event.extra_keys %} + {% for extra, metadata in event.extra_keys.items() %} + :param {{ metadata.type|py_metric_type }} {{ extra }}: {{ metadata.description|clean_string }} + {% endfor %} + {% endif %} + """ + event = { + "category": "{{ event.category }}", + "name": "{{ event.name }}", + {% if event.extra_keys %} + "extra": { + {% for extra, metadata in event.extra_keys.items() %} + "{{ extra }}": str({{ extra }}){% if 'bool' == metadata.type|py_metric_type %}.lower(){% endif %}, + {% endfor %} + }, + {% endif %} + } + self._record( + user_agent, + ip_address, + {% for metric_type, metrics in metrics_by_type.items() %} + {% if metric_type != 'event' %} + {% for metric in metrics %} + {{ metric.category }}_{{ metric.name }}, + {% endfor %} + {% endif %} + {% endfor %} + event + ) + {% endfor %} +{% endfor %} + +{% for ping in pings %} +def {{ ping|factory_method }}( + application_id: str, + app_display_version: str, + channel: str, +) -> {{ ping|camelize }}ServerEventLogger: + """ + Factory function that creates an instance of Glean Server Event Logger to record + `{{ ping }}` ping events. + :param str application_id: The application ID. + :param str app_display_version: The application display version. + :param str channel: The channel. + :return: An instance of {{ ping|camelize }}ServerEventLogger. + :rtype: {{ ping|camelize }}ServerEventLogger + """ + return {{ ping|camelize }}ServerEventLogger(application_id, app_display_version, channel) +{% endfor %} diff --git a/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 b/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 index 51e458cddf..4c54dd2b2c 100644 --- a/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 +++ b/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 @@ -8,6 +8,49 @@ Jinja2 template is not. Please file bugs! #} * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +{%- macro generate_structure(name, struct) %} +{% if struct.type == "array" %} + pub type {{ name }} = Vec<{{ name }}Item>; + + {{ generate_structure(name ~ "Item", struct["items"]) }} + +{% elif struct.type == "object" %} + #[derive(Debug, Hash, Eq, PartialEq, ::glean::traits::__serde::Serialize, ::glean::traits::__serde::Deserialize)] + #[serde(crate = "::glean::traits::__serde")] + #[serde(deny_unknown_fields)] + pub struct {{ name }} { + {% for itemname, val in struct.properties.items() %} + {% if val.type == "object" %} + #[serde(skip_serializing_if = "Option::is_none")] + pub {{itemname|snake_case}}: Option<{{ name ~ "Item" ~ itemname|Camelize ~ "Object" }}>, + {% elif val.type == "array" %} + #[serde(skip_serializing_if = "Vec::is_empty")] + pub {{itemname|snake_case}}: {{ name ~ "Item" ~ itemname|Camelize }}, + {% else %} + #[serde(skip_serializing_if = "Option::is_none")] + pub {{itemname|snake_case}}: Option<{{val.type|structure_type_name}}>, + {% endif %} + {% endfor %} + } + + {% for itemname, val in struct.properties.items() %} + {% if val.type == "array" %} + {% set nested_name = name ~ "Item" ~ itemname|Camelize %} + {{ generate_structure(nested_name, val) }} + {% elif val.type == "object" %} + {% set nested_name = name ~ "Item" ~ itemname|Camelize ~ "Object" %} + {{ generate_structure(nested_name, val) }} + {% endif %} + {% endfor %} + +{% else %} + +pub type {{ name }} = {{ struct.type|structure_type_name }}; + +{% endif %} + +{% endmacro %} + {% macro generate_extra_keys(obj) %} {% for name, _ in obj["_generate_enums"] %} {# we always use the `extra` suffix, because we only expose the new event API #} @@ -44,7 +87,7 @@ impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} { /// {{ obj.description|wordwrap() | replace('\n', '\n/// ') }} #[rustfmt::skip] pub static {{ obj.name|snake_case }}: ::glean::private::__export::Lazy<::glean::private::PingType> = - ::glean::private::__export::Lazy::new(|| ::glean::private::PingType::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.precise_timestamps|rust }}, {{ obj.reason_codes|rust }})); + ::glean::private::__export::Lazy::new(|| ::glean::private::PingType::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.precise_timestamps|rust }}, {{ obj.include_info_sections|rust }}, {{ obj.reason_codes|rust }})); {% endfor %} {% else %} pub mod {{ category.name|snake_case }} { @@ -52,6 +95,10 @@ pub mod {{ category.name|snake_case }} { use glean::{private::*, traits::ExtraKeys, traits::NoExtraKeys, CommonMetricData, HistogramType, Lifetime, TimeUnit, MemoryUnit}; {% for obj in category.objs.values() %} + {% if obj|attr("_generate_structure") %} +{{ generate_structure(obj.name|Camelize ~ "Object", obj._generate_structure) }} + {%- endif %} + {% if obj|attr("_generate_enums") %} {{ generate_extra_keys(obj) }} {%- endif %} diff --git a/third_party/python/glean_parser/glean_parser/templates/swift.jinja2 b/third_party/python/glean_parser/glean_parser/templates/swift.jinja2 index 82ad37bf20..714bf20ec2 100644 --- a/third_party/python/glean_parser/glean_parser/templates/swift.jinja2 +++ b/third_party/python/glean_parser/glean_parser/templates/swift.jinja2 @@ -96,6 +96,7 @@ extension {{ namespace }} { includeClientId: {{obj.include_client_id|swift}}, sendIfEmpty: {{obj.send_if_empty|swift}}, preciseTimestamps: {{obj.precise_timestamps|swift}}, + includeInfoSections: {{obj.include_info_sections|swift}}, reasonCodes: {{obj.reason_codes|swift}} ) diff --git a/third_party/python/glean_parser/glean_parser/translate.py b/third_party/python/glean_parser/glean_parser/translate.py index 021fce47fb..6293a99491 100644 --- a/third_party/python/glean_parser/glean_parser/translate.py +++ b/third_party/python/glean_parser/glean_parser/translate.py @@ -17,8 +17,10 @@ from typing import Any, Callable, Dict, Iterable, List, Optional from . import lint from . import parser +from . import go_server from . import javascript from . import javascript_server +from . import python_server from . import kotlin from . import markdown from . import metrics @@ -54,10 +56,12 @@ class Outputter: OUTPUTTERS = { + "go_server": Outputter(go_server.output_go, []), "javascript": Outputter(javascript.output_javascript, []), "typescript": Outputter(javascript.output_typescript, []), "javascript_server": Outputter(javascript_server.output_javascript, []), "typescript_server": Outputter(javascript_server.output_typescript, []), + "python_server": Outputter(python_server.output_python, []), "ruby_server": Outputter(ruby_server.output_ruby, []), "kotlin": Outputter(kotlin.output_kotlin, ["*.kt"]), "markdown": Outputter(markdown.output_markdown, []), diff --git a/third_party/python/glean_parser/glean_parser/util.py b/third_party/python/glean_parser/glean_parser/util.py index edaeed9578..41cda8833d 100644 --- a/third_party/python/glean_parser/glean_parser/util.py +++ b/third_party/python/glean_parser/glean_parser/util.py @@ -525,6 +525,7 @@ ping_args = [ "include_client_id", "send_if_empty", "precise_timestamps", + "include_info_sections", "reason_codes", ] -- cgit v1.2.3