From 76df6d315f5f2f6c42ad36faf562ac812880cbd1 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Fri, 11 Feb 2022 14:27:38 +0000 Subject: [PATCH] Bug 1754474 - Update to Glean 44.0.0 and glean_parser 5.0.1. r=janerik Differential Revision: https://phabricator.services.mozilla.com/D138446 --- Cargo.lock | 12 +- build.gradle | 2 +- build/mach_virtualenv_packages.txt | 2 +- .../AUTHORS.md | 0 .../LICENSE | 0 .../METADATA | 15 +- .../RECORD | 30 +- .../WHEEL | 0 .../entry_points.txt | 0 .../top_level.txt | 0 .../glean_parser/glean_parser/__main__.py | 16 +- .../glean_parser/glean_parser/csharp.py | 153 ---------- .../glean_parser/glean_parser/data_review.py | 10 +- .../glean_parser/glean_parser/metrics.py | 10 +- .../python/glean_parser/glean_parser/rust.py | 199 +++++++++++++ .../schemas/metrics.2-0-0.schema.yaml | 14 +- .../glean_parser/templates/csharp.jinja2 | 99 ------ .../glean_parser/templates/rust.jinja2 | 281 ++++++++++++++++++ .../glean_parser/glean_parser/translate.py | 10 +- .../python/glean_parser/glean_parser/util.py | 48 ++- third_party/python/requirements.in | 2 +- third_party/python/requirements.txt | 6 +- .../rust/glean-core/.cargo-checksum.json | 2 +- third_party/rust/glean-core/Cargo.lock | 42 +-- third_party/rust/glean-core/Cargo.toml | 4 +- .../rust/glean-ffi/.cargo-checksum.json | 2 +- third_party/rust/glean-ffi/Cargo.toml | 4 +- third_party/rust/glean/.cargo-checksum.json | 2 +- third_party/rust/glean/Cargo.toml | 4 +- third_party/rust/glean/src/lib.rs | 40 ++- toolkit/components/glean/Cargo.toml | 4 +- toolkit/components/glean/api/Cargo.toml | 2 +- 32 files changed, 673 insertions(+), 342 deletions(-) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/AUTHORS.md (100%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/LICENSE (100%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/METADATA (96%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/RECORD (65%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/WHEEL (100%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/entry_points.txt (100%) rename third_party/python/glean_parser/{glean_parser-4.4.0.dist-info => glean_parser-5.0.1.dist-info}/top_level.txt (100%) delete mode 100644 third_party/python/glean_parser/glean_parser/csharp.py create mode 100644 third_party/python/glean_parser/glean_parser/rust.py delete mode 100644 third_party/python/glean_parser/glean_parser/templates/csharp.jinja2 create mode 100644 third_party/python/glean_parser/glean_parser/templates/rust.jinja2 diff --git a/Cargo.lock b/Cargo.lock index 0623521ea98c..cdb0f0e9e90b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2107,9 +2107,9 @@ dependencies = [ [[package]] name = "glean" -version = "43.0.2" +version = "44.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee21709bc0417a5e2b8ea436717bba01c6851111d3ac096994efa73bb79dab" +checksum = "d39b68297fbdd3a9cf37243ab30913542cfce546b4c58a5cd7f4ee9cd9ab3d02" dependencies = [ "chrono", "crossbeam-channel", @@ -2127,9 +2127,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "43.0.2" +version = "44.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6078d68e763d57610d362f34223f856fff64d8d3b1c8974833c9fa02a971f59c" +checksum = "7b26fe58cf3ba06a2902239e5c26511a1269e57d61214870837b0ac968332616" dependencies = [ "bincode", "chrono", @@ -2147,9 +2147,9 @@ dependencies = [ [[package]] name = "glean-ffi" -version = "43.0.2" +version = "44.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33681c61cb007b4d4c19b3cac1a8e74b211f7afe88f179328c04a3bc72ec466" +checksum = "30511afa692ca3764711da025e0bcd8f07dd09271d9885ee70fa4c970fe91e41" dependencies = [ "android_logger", "env_logger", diff --git a/build.gradle b/build.gradle index 7f661b9d868d..1b328c0623e9 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ allprojects { topsrcdir = gradle.mozconfig.topsrcdir topobjdir = gradle.mozconfig.topobjdir - gleanVersion = "43.0.2" + gleanVersion = "44.0.0" if (gleanVersion != getRustVersionFor("glean")) { throw new StopExecutionException("Mismatched Glean version, expected: ${gleanVersion}," + " found ${getRustVersionFor("glean")}") diff --git a/build/mach_virtualenv_packages.txt b/build/mach_virtualenv_packages.txt index 627907c70cbb..84cecb4438f1 100644 --- a/build/mach_virtualenv_packages.txt +++ b/build/mach_virtualenv_packages.txt @@ -129,7 +129,7 @@ pth:xpcom/geckoprocesstypes_generator pth:xpcom/idl-parser # glean-sdk may not be installable if a wheel isn't available # and it has to be built from source. -pypi-optional:glean-sdk==43.0.2:telemetry will not be collected +pypi-optional:glean-sdk==44.0.0:telemetry will not be collected # Mach gracefully handles the case where `psutil` is unavailable. # We aren't (yet) able to pin packages in automation, so we have to # support down to the oldest locally-installed version (5.4.2). diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/AUTHORS.md b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/AUTHORS.md similarity index 100% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/AUTHORS.md rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/AUTHORS.md diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/LICENSE b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/LICENSE similarity index 100% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/LICENSE rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/LICENSE diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/METADATA b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/METADATA similarity index 96% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/METADATA rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/METADATA index dc59b02d6e8f..3aeeacd784d6 100644 --- a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/METADATA +++ b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: glean-parser -Version: 4.4.0 +Version: 5.0.1 Summary: Parser tools for Mozilla's Glean telemetry Home-page: https://github.com/mozilla/glean_parser Author: Michael Droettboom @@ -85,6 +85,19 @@ $ glean_parser check < ping.json ## Unreleased +## 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)) diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/RECORD b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/RECORD similarity index 65% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/RECORD rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/RECORD index 32d5a345b587..3e8236f85311 100644 --- a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/RECORD +++ b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/RECORD @@ -1,37 +1,37 @@ glean_parser/__init__.py,sha256=kaoYIRhwZiOE1d8TniW1SHSlEivLBXZQJJ3eiDcamvQ,538 -glean_parser/__main__.py,sha256=1lA0kuQkEIMZSnG8xYha5dASadwEHI5-MeHmuNqyViA,6509 +glean_parser/__main__.py,sha256=qX305uTa4EqFFDTpBWoh3i2zwS_TXW3nJPKfdmMoOBI,6769 glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405 -glean_parser/csharp.py,sha256=tOrwOLjJCnfie0GvhWvg0Q3fnP4VFQM_4GRaaAqUh4I,5242 -glean_parser/data_review.py,sha256=SjbeSdmZTTg1a2cTxsrQPRRoQxwqhNMtfUjyK_yrhtw,4767 +glean_parser/data_review.py,sha256=pTWIg__B6h32G1udHkR3snwjGo2wJ9uRLXA411nzClo,5031 glean_parser/javascript.py,sha256=e2hslgxRB56aS2_JVOkatKexrblcz6-XqsDnGuw0MPQ,8150 glean_parser/kotlin.py,sha256=V_Toa2ims5GBHOap6nkxL7ShmaaBDb0EPXhxVdjEt9g,12294 glean_parser/lint.py,sha256=_N294HLf5-PgGa-oQxb64xcLP24W9874IGheGzjO6jk,17088 glean_parser/markdown.py,sha256=0auYAmzIrX0kqmQyq9DKkRRvTE66yAYdrU-YMgLhrpw,8996 -glean_parser/metrics.py,sha256=Z0gkVMHH-u4eCu_bpsu5JKm9gumZhCz1Jq-xSmHjo8k,11621 +glean_parser/metrics.py,sha256=o3cjNAA8uCrraYXokcdaaFPOT3yGQ8wvkVPQgkYWcrI,11873 glean_parser/parser.py,sha256=OydnNQYHfNW_UKNzZuZCL-ZEAxTlVzsabXNMxmUuht4,15741 glean_parser/pings.py,sha256=6XakkO9jnQc2oojLQJvTCMwF7w-BEm6rR54tunCb38o,2805 +glean_parser/rust.py,sha256=mJ_fd5dfofx30U6eZhBADN53ZfTDLGLDhr0FKmeLeRw,5973 glean_parser/swift.py,sha256=fWI41IcVhMaOAta9V1xBm7_Y5AjT_-uGXytiXaxbfzI,7982 glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391 -glean_parser/translate.py,sha256=ZyWEEp1bQO2-cneiC-YvbCuTUEra-xgp33X6dkvtgUY,7476 -glean_parser/util.py,sha256=XWVBr2b5k-GJhx4-_i4JgE2hejCr1q0IbxvfmRFgdsE,15369 +glean_parser/translate.py,sha256=93pJfbocM81TC9tlt7Gg3-L5KNTme75glEPrF5tenqI,7743 +glean_parser/util.py,sha256=aahrqfadLSmp9tGjCEKpTgRGEp4yHcqv9MooCeP80iA,16617 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=lXjTXyAVaBlx7DNjE8Y4PaOs7au2hGTMs8zSnZxV8Tk,23225 +glean_parser/schemas/metrics.2-0-0.schema.yaml,sha256=P5-hNS1Tz-kTo66v4xThU1mS21iwpgjg7CWC4Iybl1E,23886 glean_parser/schemas/pings.1-0-0.schema.yaml,sha256=hwCnsKpEysmrmVp-QHGBArEkVY3vaU1rVsxlTwhAzws,4315 glean_parser/schemas/pings.2-0-0.schema.yaml,sha256=rD1s-rfz1xC9biHyLfBCnsoQxVYHwpe_S05awfe2xDA,4363 glean_parser/schemas/tags.1-0-0.schema.yaml,sha256=OGXIJlvvVW1vaqB_NVZnwKeZ-sLlfH57vjBSHbj6DNI,1231 -glean_parser/templates/csharp.jinja2,sha256=tPj09JzgSK0YyNb53WkL8WFTA7fcVXyiJ7V-bARnfM0,4354 glean_parser/templates/javascript.jinja2,sha256=Qiv0lxsqVABzdME1MRsmezwtwn8_hHdH9S_v8fJAh-E,2647 glean_parser/templates/kotlin.buildinfo.jinja2,sha256=m5OngVSjLv4CwpsyNc5Z2O5kixejOXsiIYgzhAkANVA,899 glean_parser/templates/kotlin.geckoview.jinja2,sha256=K0c1BeKSXDVbshC3gpWALCQFp2JtsoqWhGyN1ScPhC0,5077 glean_parser/templates/kotlin.jinja2,sha256=fsFXKI_fKwj5AEO4odJ5sRvoC5geW59_DhU6GATaA90,4475 glean_parser/templates/markdown.jinja2,sha256=tOMN62xEGA1p8QoMKnpCVXUiK_jI5GwLuvCnuOROy8c,3381 glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156 +glean_parser/templates/rust.jinja2,sha256=CtoFNkVB3NFxeTzUIjTxJHmhp2CyhoBap7tkM9SxRWE,10592 glean_parser/templates/swift.jinja2,sha256=qDsAANvlIdcZUo_WwE1G_Sbp4XepxBoBGLMbaOmJwjk,5077 -glean_parser-4.4.0.dist-info/AUTHORS.md,sha256=jBsSsn3EpmpLejgHMhzU1XTFwkCARqYeUs9iGLNgwkQ,432 -glean_parser-4.4.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725 -glean_parser-4.4.0.dist-info/METADATA,sha256=dyViwyJtouX-bFuMzOeoUluaOZ0Ct9q2Yu1mdRbN8p4,23214 -glean_parser-4.4.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -glean_parser-4.4.0.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69 -glean_parser-4.4.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13 -glean_parser-4.4.0.dist-info/RECORD,, +glean_parser-5.0.1.dist-info/AUTHORS.md,sha256=jBsSsn3EpmpLejgHMhzU1XTFwkCARqYeUs9iGLNgwkQ,432 +glean_parser-5.0.1.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725 +glean_parser-5.0.1.dist-info/METADATA,sha256=ui6vTxp0wDoGzs1jpFbxsGpz157XECoTAOuoxJxAIgo,24079 +glean_parser-5.0.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 +glean_parser-5.0.1.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69 +glean_parser-5.0.1.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13 +glean_parser-5.0.1.dist-info/RECORD,, diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/WHEEL b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/WHEEL similarity index 100% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/WHEEL rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/WHEEL diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/entry_points.txt b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/entry_points.txt similarity index 100% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/entry_points.txt rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/entry_points.txt diff --git a/third_party/python/glean_parser/glean_parser-4.4.0.dist-info/top_level.txt b/third_party/python/glean_parser/glean_parser-5.0.1.dist-info/top_level.txt similarity index 100% rename from third_party/python/glean_parser/glean_parser-4.4.0.dist-info/top_level.txt rename to third_party/python/glean_parser/glean_parser-5.0.1.dist-info/top_level.txt diff --git a/third_party/python/glean_parser/glean_parser/__main__.py b/third_party/python/glean_parser/glean_parser/__main__.py index a0edb0531994..2ff0ab9a4c03 100644 --- a/third_party/python/glean_parser/glean_parser/__main__.py +++ b/third_party/python/glean_parser/glean_parser/__main__.py @@ -68,8 +68,21 @@ from . import validate_ping is_flag=True, help=("Require tags to be specified for metrics and pings."), ) +@click.option( + "--expire-by-version", + help="Expire metrics by version, with the provided major version.", + type=click.INT, + required=False, +) def translate( - input, format, output, option, allow_reserved, allow_missing_files, require_tags + input, + format, + output, + option, + allow_reserved, + allow_missing_files, + require_tags, + expire_by_version, ): """ Translate metrics.yaml and pings.yaml files to other formats. @@ -89,6 +102,7 @@ def translate( "allow_reserved": allow_reserved, "allow_missing_files": allow_missing_files, "require_tags": require_tags, + "expire_by_version": expire_by_version, }, ) ) diff --git a/third_party/python/glean_parser/glean_parser/csharp.py b/third_party/python/glean_parser/glean_parser/csharp.py deleted file mode 100644 index 6ed8cb0338ea..000000000000 --- a/third_party/python/glean_parser/glean_parser/csharp.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- 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 C# code for metrics. -""" - -import enum -import json -from pathlib import Path -from typing import Any, Dict, List, Optional, Union # noqa - -from . import metrics -from . import pings -from . import util - - -def csharp_datatypes_filter(value: util.JSONType) -> str: - """ - A Jinja2 filter that renders C# literals. - - Based on Python's JSONEncoder, but overrides: - - lists to use `new string[] {}` (only strings) - - dicts to use `new Dictionary { ...}` (string, string) - - sets to use `new HashSet() {}` (only strings) - - enums to use the like-named C# enum - """ - - class CSharpEncoder(json.JSONEncoder): - def iterencode(self, value): - if isinstance(value, list): - assert all(isinstance(x, str) for x in value) - yield "new string[] {" - first = True - for subvalue in value: - if not first: - yield ", " - yield from self.iterencode(subvalue) - first = False - yield "}" - elif isinstance(value, dict): - yield "new Dictionary {" - first = True - for key, subvalue in value.items(): - if not first: - yield ", " - yield "{" - yield from self.iterencode(key) - yield ", " - yield from self.iterencode(subvalue) - yield "}" - first = False - yield "}" - elif isinstance(value, enum.Enum): - yield (value.__class__.__name__ + "." + util.Camelize(value.name)) - elif isinstance(value, set): - yield "new HashSet() {" - first = True - for subvalue in sorted(list(value)): - if not first: - yield ", " - yield from self.iterencode(subvalue) - first = False - yield "}" - else: - yield from super().iterencode(value) - - return "".join(CSharpEncoder().iterencode(value)) - - -def type_name(obj: Union[metrics.Metric, pings.Ping]) -> str: - """ - Returns the C# type to use for a given metric or ping object. - """ - generate_enums = getattr(obj, "_generate_enums", []) - if len(generate_enums): - template_args = [] - for member, suffix in generate_enums: - if len(getattr(obj, member)): - template_args.append(util.camelize(obj.name) + suffix) - else: - if suffix == "Keys": - template_args.append("NoExtraKeys") - else: - template_args.append("No" + suffix) - - return "{}<{}>".format(class_name(obj.type), ", ".join(template_args)) - - return class_name(obj.type) - - -def class_name(obj_type: str) -> str: - """ - Returns the C# class name for a given metric or ping type. - """ - if obj_type == "ping": - return "PingType" - if obj_type.startswith("labeled_"): - obj_type = obj_type[8:] - return util.Camelize(obj_type) + "MetricType" - - -def output_csharp( - objs: metrics.ObjectTree, output_dir: Path, options: Optional[Dict[str, Any]] = None -) -> None: - """ - Given a tree of objects, output C# code to `output_dir`. - - :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. - :param options: options dictionary, with the following optional keys: - - - `namespace`: The package namespace to declare at the top of the - generated files. Defaults to `GleanMetrics`. - - `glean_namespace`: The package namespace of the glean library itself. - This is where glean objects will be imported from in the generated - code. - """ - if options is None: - options = {} - - template = util.get_jinja2_template( - "csharp.jinja2", - filters=( - ("csharp", csharp_datatypes_filter), - ("type_name", type_name), - ("class_name", class_name), - ), - ) - - namespace = options.get("namespace", "GleanMetrics") - glean_namespace = options.get("glean_namespace", "Mozilla.Glean") - - for category_key, category_val in objs.items(): - filename = util.Camelize(category_key) + ".cs" - filepath = output_dir / filename - - with filepath.open("w", encoding="utf-8") as fd: - fd.write( - template.render( - category_name=category_key, - objs=category_val, - extra_args=util.extra_args, - namespace=namespace, - glean_namespace=glean_namespace, - ) - ) - # Jinja2 squashes the final newline, so we explicitly add it - fd.write("\n") diff --git a/third_party/python/glean_parser/glean_parser/data_review.py b/third_party/python/glean_parser/glean_parser/data_review.py index 2f1ccc0f6b99..f0f7997d3aca 100644 --- a/third_party/python/glean_parser/glean_parser/data_review.py +++ b/third_party/python/glean_parser/glean_parser/data_review.py @@ -45,6 +45,7 @@ def generate( # I tried [\W\Z] but it complained. So `|` it is. reobj = re.compile(f"\\W{bug}\\W|\\W{bug}$") durations = set() + responsible_emails = set() metrics_table = "" for category_name, metrics in all_objects.value.items(): for metric in metrics.values(): @@ -61,6 +62,9 @@ def generate( durations.add(metric.expires) + if metric.expires == "never": + responsible_emails.update(metric.notification_emails) + if len(durations) == 1: duration = next(iter(durations)) if duration == "never": @@ -72,9 +76,13 @@ def generate( collection_duration += f"{durations}" if "never" in durations: - collection_duration += "\n**TODO: identify at least one individual here** " + collection_duration += "\n" + ", ".join(responsible_emails) + " " collection_duration += "will be responsible for the permanent collections." + if len(durations) == 0: + print(f"I'm sorry, I couldn't find metrics matching the bug number {bug}.") + return 1 + # This template is pulled from # https://github.com/mozilla/data-review/blob/main/request.md print( diff --git a/third_party/python/glean_parser/glean_parser/metrics.py b/third_party/python/glean_parser/glean_parser/metrics.py index 8f1e7d06d96b..b8b324a3b5f0 100644 --- a/third_party/python/glean_parser/glean_parser/metrics.py +++ b/third_party/python/glean_parser/glean_parser/metrics.py @@ -198,10 +198,16 @@ class Metric: return self.disabled or self.is_expired() def is_expired(self) -> bool: - return self._config.get("custom_is_expired", util.is_expired)(self.expires) + def default_handler(expires) -> bool: + return util.is_expired(expires, self._config.get("expire_by_version")) + + return self._config.get("custom_is_expired", default_handler)(self.expires) def validate_expires(self): - return self._config.get("custom_validate_expires", util.validate_expires)( + def default_handler(expires): + return util.validate_expires(expires, self._config.get("expire_by_version")) + + return self._config.get("custom_validate_expires", default_handler)( self.expires ) diff --git a/third_party/python/glean_parser/glean_parser/rust.py b/third_party/python/glean_parser/glean_parser/rust.py new file mode 100644 index 000000000000..f0d8b78290e3 --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/rust.py @@ -0,0 +1,199 @@ +# -*- 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 Rust code for metrics. +""" + +import enum +import json +from pathlib import Path +from typing import Any, Dict, Optional, Union + +from . import metrics +from . import pings +from . import tags +from . import util + + +def rust_datatypes_filter(value): + """ + A Jinja2 filter that renders Rust literals. + + Based on Python's JSONEncoder, but overrides: + - dicts and sets to raise an error + - sets to vec![] (used in labels) + - enums to become Class::Value + - lists to vec![] (used in send_in_pings) + - null to None + - strings to "value".into() + - Rate objects to a CommonMetricData initializer + (for external Denominators' Numerators lists) + """ + + class RustEncoder(json.JSONEncoder): + def iterencode(self, value): + if isinstance(value, dict): + raise ValueError("RustEncoder doesn't know dicts {}".format(str(value))) + elif isinstance(value, enum.Enum): + yield (value.__class__.__name__ + "::" + util.Camelize(value.name)) + elif isinstance(value, set): + yield "vec![" + first = True + for subvalue in sorted(list(value)): + if not first: + yield ", " + yield from self.iterencode(subvalue) + first = False + yield "]" + elif isinstance(value, list): + yield "vec![" + first = True + for subvalue in list(value): + if not first: + yield ", " + yield from self.iterencode(subvalue) + first = False + yield "]" + elif value is None: + yield "None" + elif isinstance(value, str): + yield f'"{value}".into()' + else: + yield from super().iterencode(value) + + return "".join(RustEncoder().iterencode(value)) + + +def ctor(obj): + """ + Returns the scope and name of the constructor to use for a metric object. + Necessary because LabeledMetric is constructed using LabeledMetric::new + not LabeledMetric::new + """ + if getattr(obj, "labeled", False): + return "LabeledMetric::new" + return class_name(obj.type) + "::new" + + +def type_name(obj): + """ + Returns the Rust type to use for a given metric or ping object. + """ + + if getattr(obj, "labeled", False): + return "LabeledMetric".format(class_name(obj.type)) + generate_enums = getattr(obj, "_generate_enums", []) # Extra Keys? Reasons? + if len(generate_enums): + for name, suffix in generate_enums: + if not len(getattr(obj, name)) and suffix == "Keys": + return class_name(obj.type) + "" + else: + # we always use the `extra` suffix, + # because we only expose the new event API + suffix = "Extra" + return "{}<{}>".format( + class_name(obj.type), util.Camelize(obj.name) + suffix + ) + return class_name(obj.type) + + +def extra_type_name(typ: str) -> str: + """ + Returns the corresponding Rust type for event's extra key types. + """ + + if typ == "boolean": + return "bool" + elif typ == "string": + return "String" + elif typ == "quantity": + return "u32" + else: + return "UNSUPPORTED" + + +def class_name(obj_type): + """ + Returns the Rust class name for a given metric or ping type. + """ + if obj_type == "ping": + return "Ping" + if obj_type.startswith("labeled_"): + obj_type = obj_type[8:] + return util.Camelize(obj_type) + "Metric" + + +def extra_keys(allowed_extra_keys): + """ + Returns the &'static [&'static str] ALLOWED_EXTRA_KEYS for impl ExtraKeys + """ + return "&[" + ", ".join([f'"{key}"' for key in allowed_extra_keys]) + "]" + + +class Category: + """ + Data struct holding information about a metric to be used in the template. + """ + + def __init__( + self, + name: str, + objs: Dict[str, Union[metrics.Metric, pings.Ping, tags.Tag]], + contains_pings: bool, + ): + self.name = name + self.objs = objs + self.contains_pings = contains_pings + + +def output_rust( + objs: metrics.ObjectTree, output_dir: Path, options: Optional[Dict[str, Any]] = None +) -> None: + """ + Given a tree of objects, output Rust code to `output_dir`. + + :param objs: A tree of objects (metrics and pings) as returned from + `parser.parse_objects`. + :param output_dir: Path to an output directory to write to. + :param options: options dictionary, not currently used for Rust + """ + + if options is None: + options = {} + + template = util.get_jinja2_template( + "rust.jinja2", + filters=( + ("rust", rust_datatypes_filter), + ("snake_case", util.snake_case), + ("camelize", util.camelize), + ("type_name", type_name), + ("extra_type_name", extra_type_name), + ("ctor", ctor), + ("extra_keys", extra_keys), + ), + ) + + filename = "glean_metrics.rs" + filepath = output_dir / filename + categories = [] + + for category_key, category_val in objs.items(): + contains_pings = any( + isinstance(obj, pings.Ping) for obj in category_val.values() + ) + + cat = Category(category_key, category_val, contains_pings) + categories.append(cat) + + with filepath.open("w", encoding="utf-8") as fd: + fd.write( + template.render( + categories=categories, + extra_args=util.metric_args, + ) + ) 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 ed2ac434b1b2..1b0d321814f3 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 @@ -270,12 +270,24 @@ definitions: metric expires. For example, `2019-03-13`. This date is checked at build time. Except in special cases, this form should be used so that the metric automatically "sunsets" after a period of time. + - ``: An integer greater than 0 representing the + major version the metric expires in. For example, `11`. The + version is checked at build time against the major provided to the + glean_parser and is only valid if a major version is provided at + built time. If no major version is provided at build time and + expiration by major version is used for a metric, an error is + raised. + Note that mixing expiration by date and version is not allowed + within a product. - `never`: This metric never expires. - `expired`: This metric is manually expired. The default may be overriden in certain applications by the `custom_validate_expires` and `custom_is_expired` configs. - type: string + oneOf: + - type: string + - type: integer + minimum: 1 version: title: Metric version diff --git a/third_party/python/glean_parser/glean_parser/templates/csharp.jinja2 b/third_party/python/glean_parser/glean_parser/templates/csharp.jinja2 deleted file mode 100644 index 430ea42f4d76..000000000000 --- a/third_party/python/glean_parser/glean_parser/templates/csharp.jinja2 +++ /dev/null @@ -1,99 +0,0 @@ -// -*- mode: csharp -*- - -/* - * AUTOGENERATED BY glean_parser. DO NOT EDIT. DO NOT COMMIT. - */ -{# The rendered markdown is autogenerated, but this -Jinja2 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/. -{% macro obj_declaration(obj, suffix='', access='', lazy=False) %} -{{ access }} {% if lazy %} Lazy<{{ obj|type_name }}>{%- else %} {{ obj|type_name }}{% endif %} {{ obj.name|camelize }}{{ suffix }} -{%- if lazy %} = new Lazy<{{ obj|type_name }}>(() => {%- else %} = // generated from {{ obj.identifier() }}{% endif %} - - new {{ obj|type_name }}( - {% for arg_name in extra_args if obj[arg_name] is defined %} - {{ arg_name|camelize }}: {{ obj[arg_name]|csharp }}{{ "," if not loop.last }} - {% endfor %} - ){% if lazy %});{% else %};{% endif %}{% endmacro %} - -using System; -using System.Collections.Generic; -using {{ glean_namespace }}.Private; - -{# The C# metrics design require the class name to have a 'Definition' -suffix, in order to nicely call in the metrics from the consumer code. -The user code will be interested in the Value of the lazy instance, so -that's where the real class name should be used. #} -{% set metrics_class_name = category_name|Camelize + 'Definition' %} -namespace {{ namespace }} -{ - internal sealed class {{ metrics_class_name }} - { - private static readonly Lazy<{{ metrics_class_name }}> - lazyInstance = new Lazy<{{ metrics_class_name }}>(() => new {{ metrics_class_name }}()); - public static {{ metrics_class_name }} {{ category_name|Camelize }} => lazyInstance.Value; - - // Private constructor to disallow instantiation from external callers. - private {{ metrics_class_name }}() { } - -#pragma warning disable IDE1006 // Naming Styles - {% for obj in objs.values() %} - {% if obj|attr("_generate_enums") %} - {% for name, suffix in obj["_generate_enums"] %} - {% if obj|attr(name)|length %} - internal enum {{ obj.name|camelize }}{{ suffix }} { - {% for key in obj|attr(name) %} - {{ key|camelize }}{{ "," if not loop.last }} - {% endfor %} - } - {% endif %} - {% endfor %} - {% endif %} - {% endfor %} - - {% for obj in objs.values() %} - {% if obj.labeled %} - {{ obj_declaration(obj, 'Label', 'private ') }} - private readonly Lazy> {{ obj.name|camelize }}Lazy = new Lazy>(() => new LabeledMetricType<{{ obj|type_name }}>( // generated from {{ obj.identifier() }} - category: {{ obj.category|csharp }}, - name: {{ obj.name|csharp }}, - submetric: {{ category_name|Camelize }}.{{ obj.name|camelize }}Label, - disabled: {{ obj.is_disabled()|csharp }}, - lifetime: {{ obj.lifetime|csharp }}, - sendInPings: {{ obj.send_in_pings|csharp }}, - labels: {{ obj.labels|csharp }} - ) - ); - - /// - /// {{ obj.description|wordwrap() | replace('\n', '\n /// ') }} - /// - public LabeledMetricType<{{ obj|type_name }}> {{ obj.name|camelize }} => {{ obj.name|camelize }}Lazy.Value; - - {% else %} - {# Deal with non-ping objects first. We need them to be lazy and we - want their description to stick on an accessor object. #} - {% if obj.type != 'ping' %} - {{ obj_declaration(obj, access='private readonly', suffix='Lazy', lazy=True) }} - - /// - /// {{ obj.description|wordwrap() | replace('\n', '\n /// ') }} - /// - internal {{ obj|type_name }} {{ obj.name|camelize }} => {{ obj.name|camelize }}Lazy.Value; // generated from {{ obj.identifier() }} - - {% else %} - {# Finally handle pings. #} - /// - /// {{ obj.description|wordwrap() | replace('\n', '\n /// ') }} - /// - {{ obj_declaration(obj, access='internal readonly', lazy=False) }} - - {% endif %} - {% endif %} - {%- endfor %} -#pragma warning restore IDE1006 // Naming Styles - } -} diff --git a/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 b/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 new file mode 100644 index 000000000000..5012023bc7ac --- /dev/null +++ b/third_party/python/glean_parser/glean_parser/templates/rust.jinja2 @@ -0,0 +1,281 @@ +// -*- mode: Rust -*- + +// AUTOGENERATED BY glean_parser. DO NOT EDIT. +{# The rendered source is autogenerated, but this +Jinja2 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/. */ + +{% 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 #} +{% set suffix = "Extra" %} +{% if obj|attr(name)|length %} + {% if obj.has_extra_types %} + {{ extra_keys_with_types(obj, name, suffix)|indent }} + {% else %} + compile_error!("Untyped event extras not supported. Please annotate event extras with a type. See documentation for details. (Metric: {{obj.category}}.{{obj.name}}, defined in: {{obj.defined_in['filepath']}}:{{obj.defined_in['line']}})"); + {% endif %} +{% endif %} +{% endfor %} +{% endmacro %} +{% macro extra_keys_with_types(obj, name, suffix) %} +#[derive(Default, Debug, Clone, Hash, Eq, PartialEq)] +pub struct {{ obj.name|Camelize }}{{ suffix }} { + {% for item, type in obj|attr(name) %} + pub {{ item|snake_case }}: Option<{{type|extra_type_name}}>, + {% endfor %} +} + +impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} { + const ALLOWED_KEYS: &'static [&'static str] = {{ obj.allowed_extra_keys|extra_keys }}; + + fn into_ffi_extra(self) -> ::std::collections::HashMap { + let mut map = ::std::collections::HashMap::new(); + {% for key, _ in obj|attr(name) %} + self.{{key|snake_case}}.and_then(|val| map.insert({{loop.index-1}}, val)); + {% endfor %} + map + } +} +{% endmacro %} +{% for category in categories %} +{% if category.contains_pings %} +use glean::private::Ping; +use once_cell::sync::Lazy; +{% for obj in category.objs.values() %} + +#[allow(non_upper_case_globals, dead_code)] +/// {{ obj.description|wordwrap() | replace('\n', '\n/// ') }} +#[rustfmt::skip] +pub static {{ obj.name|snake_case }}: Lazy = + Lazy::new(|| Ping::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.reason_codes|rust }})); +{% endfor %} +{% else %} +pub mod {{ category.name|snake_case }} { + #[allow(unused_imports)] // HistogramType might be unusued, let's avoid warnings + use glean::{private::*, traits::ExtraKeys, CommonMetricData, HistogramType, Lifetime}; + use once_cell::sync::Lazy; + {% for obj in category.objs.values() %} + + {% if obj|attr("_generate_enums") %} +{{ generate_extra_keys(obj) }} + {%- endif %} + #[allow(non_upper_case_globals, dead_code)] + /// generated from {{ category.name }}.{{ obj.name }} + /// + /// {{ obj.description|wordwrap() | replace('\n', '\n /// ') }} + pub static {{ obj.name|snake_case }}: Lazy<{{ obj|type_name }}> = Lazy::new(|| { + {{ obj|ctor }}(CommonMetricData { + category: {{ obj.category|rust }}, + name: {{ obj.name|rust }}, + send_in_pings: {{ obj.send_in_pings|rust }}, + lifetime: {{ obj.lifetime|rust }}, + disabled: {{ obj.is_disabled()|rust }}, + ..Default::default() + }{{ ", " if obj.labeled else ")\n" }} + {%- if obj.labeled -%} + {%- if obj.labels -%} + Some({{ obj.labels|rust }}) + {%- else -%} + None + {%- endif -%}) + {% endif %} + }); + {% endfor %} +} +{% endif %} +{% endfor %} +{% if metric_by_type|length > 0 %} + +#[allow(dead_code)] +pub(crate) mod __glean_metric_maps { + use std::collections::HashMap; + + use super::{id_for_extra_key, extra_keys_len}; + use crate::private::*; + use once_cell::sync::Lazy; + +{% for typ, metrics in metric_by_type.items() %} + pub static {{typ.0}}: Lazy>> = Lazy::new(|| { + let mut map = HashMap::with_capacity({{metrics|length}}); + {% for metric in metrics %} + map.insert({{metric.0}}.into(), &super::{{metric.1}}); + {% endfor %} + map + }); + +{% endfor %} + + /// Wrapper to record an event based on its metric ID. + /// + /// # Arguments + /// + /// * `metric_id` - The metric's ID to look up + /// * `extra` - An map of (extra key id, string) pairs. + /// The map will be decoded into the appropriate `ExtraKeys` type. + /// # Returns + /// + /// Returns `Ok(())` if the event was found and `record` was called with the given `extra`, + /// or an `EventRecordingError::InvalidId` if no event by that ID exists + /// or an `EventRecordingError::InvalidExtraKey` if the `extra` map could not be deserialized. + pub(crate) fn record_event_by_id(metric_id: u32, extra: HashMap) -> Result<(), EventRecordingError> { + match metric_id { +{% for metric_id, event in events_by_id.items() %} + {{metric_id}} => { + assert!( + extra_keys_len(&super::{{event}}) != 0 || extra.is_empty(), + "No extra keys allowed, but some were passed" + ); + + super::{{event}}.record_raw(extra); + Ok(()) + } +{% endfor %} + _ => Err(EventRecordingError::InvalidId), + } + } + + /// Wrapper to record an event based on its metric ID, with a provided timestamp. + /// + /// # Arguments + /// + /// * `metric_id` - The metric's ID to look up + /// * `timestamp` - The time at which this event was recorded. + /// * `extra` - An map of (extra key id, string) pairs. + /// The map will be decoded into the appropriate `ExtraKeys` type. + /// # Returns + /// + /// Returns `Ok(())` if the event was found and `record` was called with the given `extra`, + /// or an `EventRecordingError::InvalidId` if no event by that ID exists + /// or an `EventRecordingError::InvalidExtraKey` if the event doesn't take extra pairs, + /// but some are passed in. + pub(crate) fn record_event_by_id_with_time(metric_id: MetricId, timestamp: u64, extra: HashMap) -> Result<(), EventRecordingError> { + match metric_id { +{% for metric_id, event in events_by_id.items() %} + MetricId({{metric_id}}) => { + if extra_keys_len(&super::{{event}}) == 0 && !extra.is_empty() { + return Err(EventRecordingError::InvalidExtraKey); + } + + super::{{event}}.record_with_time(timestamp, extra); + Ok(()) + } +{% endfor %} + _ => Err(EventRecordingError::InvalidId), + } + } + + /// Wrapper to record an event based on its metric ID. + /// + /// # Arguments + /// + /// * `metric_id` - The metric's ID to look up + /// * `extra` - An map of (string, string) pairs. + /// The map will be decoded into the appropriate `ExtraKeys` types. + /// # Returns + /// + /// Returns `Ok(())` if the event was found and `record` was called with the given `extra`, + /// or an `EventRecordingError::InvalidId` if no event by that ID exists + /// or an `EventRecordingError::InvalidExtraKey` if the `extra` map could not be deserialized. + pub(crate) fn record_event_by_id_with_strings(metric_id: u32, extra: HashMap) -> Result<(), EventRecordingError> { + match metric_id { +{% for metric_id, event in events_by_id.items() %} + {{metric_id}} => { + assert!( + extra_keys_len(&super::{{event}}) != 0 || extra.is_empty(), + "No extra keys allowed, but some were passed" + ); + + let extra = extra + .into_iter() + .map(|(k, v)| id_for_extra_key(&*k, &super::{{event}}).map(|k| (k, v))) + .collect::, _>>()?; + super::{{event}}.record_raw(extra); + Ok(()) + } +{% endfor %} + _ => Err(EventRecordingError::InvalidId), + } + } + + /// Wrapper to get the currently stored events for event metric. + /// + /// # Arguments + /// + /// * `metric_id` - The metric's ID to look up + /// * `ping_name` - (Optional) The ping name to look into. + /// Defaults to the first value in `send_in_pings`. + /// + /// # Returns + /// + /// Returns the recorded events or `None` if nothing stored. + /// + /// # Panics + /// + /// Panics if no event by the given metric ID could be found. + pub(crate) fn event_test_get_value_wrapper(metric_id: u32, ping_name: Option) -> Option> { + match metric_id { +{% for metric_id, event in events_by_id.items() %} + {{metric_id}} => super::{{event}}.test_get_value(ping_name.as_deref()), +{% endfor %} + _ => panic!("No event for metric id {}", metric_id), + } + } + + /// Check the provided event for errors. + /// + /// # Arguments + /// + /// * `metric_id` - The metric's ID to look up + /// * `ping_name` - (Optional) The ping name to look into. + /// Defaults to the first value in `send_in_pings`. + /// + /// # Returns + /// + /// Returns a string for the recorded error or `None`. + /// + /// # Panics + /// + /// Panics if no event by the given metric ID could be found. + #[allow(unused_variables)] + pub(crate) fn event_test_get_error(metric_id: u32, ping_name: Option) -> Option { + #[cfg(feature = "with_gecko")] + match metric_id { +{% for metric_id, event in events_by_id.items() %} + {{metric_id}} => test_get_errors_string!(super::{{event}}, ping_name), +{% endfor %} + _ => panic!("No event for metric id {}", metric_id), + } + + #[cfg(not(feature = "with_gecko"))] + { + return None; + } + } + + pub(crate) mod submetric_maps { + use std::sync::{ + atomic::AtomicU32, + RwLock, + }; + use super::*; + + pub(crate) const MIN_LABELED_SUBMETRIC_ID: u32 = {{min_submetric_id}}; + pub(crate) static NEXT_LABELED_SUBMETRIC_ID: AtomicU32 = AtomicU32::new(MIN_LABELED_SUBMETRIC_ID); + pub(crate) static LABELED_METRICS_TO_IDS: Lazy>> = Lazy::new(|| + RwLock::new(HashMap::new()) + ); + +{% for typ, metrics in metric_by_type.items() %} +{% if typ.0 in ('BOOLEAN_MAP', 'COUNTER_MAP', 'STRING_MAP') %} + pub static {{typ.0}}: Lazy>> = Lazy::new(|| + RwLock::new(HashMap::new()) + ); +{% endif %} +{% endfor%} + } +} +{% endif %} \ No newline at end of file diff --git a/third_party/python/glean_parser/glean_parser/translate.py b/third_party/python/glean_parser/glean_parser/translate.py index 0fc0efbf85e9..99e2972a2c45 100644 --- a/third_party/python/glean_parser/glean_parser/translate.py +++ b/third_party/python/glean_parser/glean_parser/translate.py @@ -17,11 +17,11 @@ from typing import Any, Callable, Dict, Iterable, List, Optional from . import lint from . import parser -from . import csharp from . import javascript from . import kotlin from . import markdown from . import metrics +from . import rust from . import swift from . import util @@ -52,12 +52,12 @@ class Outputter: OUTPUTTERS = { - "csharp": Outputter(csharp.output_csharp, ["*.cs"]), "javascript": Outputter(javascript.output_javascript, []), "typescript": Outputter(javascript.output_typescript, []), "kotlin": Outputter(kotlin.output_kotlin, ["*.kt"]), "markdown": Outputter(markdown.output_markdown, []), "swift": Outputter(swift.output_swift, ["*.swift"]), + "rust": Outputter(rust.output_rust, []), } @@ -136,6 +136,12 @@ def translate_metrics( input_filepaths = util.ensure_list(input_filepaths) + allow_missing_files = parser_config.get("allow_missing_files", False) + if not input_filepaths and not allow_missing_files: + print("❌ No metric files specified. ", end="") + print("Use `--allow-missing-files` to not treat this as an error.") + return 1 + if lint.glinter(input_filepaths, parser_config): return 1 diff --git a/third_party/python/glean_parser/glean_parser/util.py b/third_party/python/glean_parser/glean_parser/util.py index f12fdd75cfe6..8d14ddaf3a40 100644 --- a/third_party/python/glean_parser/glean_parser/util.py +++ b/third_party/python/glean_parser/glean_parser/util.py @@ -374,21 +374,41 @@ def format_error( return f"{filepath}:\n{textwrap.indent(content, ' ')}" -def parse_expires(expires: str) -> datetime.date: +def parse_expiration_date(expires: str) -> datetime.date: """ Parses the expired field date (yyyy-mm-dd) as a date. Raises a ValueError in case the string is not properly formatted. """ try: return date_fromisoformat(expires) - except ValueError: + except (TypeError, ValueError): raise ValueError( f"Invalid expiration date '{expires}'. " "Must be of the form yyyy-mm-dd in UTC." ) -def is_expired(expires: str) -> bool: +def parse_expiration_version(expires: str) -> int: + """ + Parses the expired field version string as an integer. + Raises a ValueError in case the string does not contain a valid + positive integer. + """ + try: + if isinstance(expires, int): + version_number = int(expires) + if version_number > 0: + return version_number + # Fall-through: if it's not an integer or is not greater than zero, + # raise an error. + raise ValueError() + except ValueError: + raise ValueError( + f"Invalid expiration version '{expires}'. Must be a positive integer." + ) + + +def is_expired(expires: str, major_version: Optional[int] = None) -> bool: """ Parses the `expires` field in a metric or ping and returns whether the object should be considered expired. @@ -397,20 +417,32 @@ def is_expired(expires: str) -> bool: return False elif expires == "expired": return True + elif major_version is not None: + return parse_expiration_version(expires) <= major_version else: - date = parse_expires(expires) + date = parse_expiration_date(expires) return date <= datetime.datetime.utcnow().date() -def validate_expires(expires: str) -> None: +def validate_expires(expires: str, major_version: Optional[int] = None) -> None: """ - Raises a ValueError in case the `expires` is not ISO8601 parseable, - or in case the date is more than 730 days (~2 years) in the future. + If expiration by major version is enabled, raises a ValueError in + case `expires` is not a positive integer. + Otherwise raises a ValueError in case the `expires` is not ISO8601 + parseable, or in case the date is more than 730 days (~2 years) in + the future. """ if expires in ("never", "expired"): return - date = parse_expires(expires) + if major_version is not None: + parse_expiration_version(expires) + # Don't need to keep parsing dates if expiration by version + # is enabled. We don't allow mixing dates and versions for a + # single product. + return + + date = parse_expiration_date(expires) max_date = datetime.datetime.now() + datetime.timedelta(days=730) if date > max_date.date(): raise ValueError( diff --git a/third_party/python/requirements.in b/third_party/python/requirements.in index e64a8b30f5ad..189b561bb519 100644 --- a/third_party/python/requirements.in +++ b/third_party/python/requirements.in @@ -15,7 +15,7 @@ ecdsa==0.15 esprima==4.0.1 fluent.migrate==0.11 fluent.syntax==0.18.1 -glean_parser==4.4.0 +glean_parser==5.0.1 jsmin==2.1.0 json-e==2.7.0 mozilla-version==0.3.4 diff --git a/third_party/python/requirements.txt b/third_party/python/requirements.txt index 3c1d1eaf71ca..e4513db8479f 100644 --- a/third_party/python/requirements.txt +++ b/third_party/python/requirements.txt @@ -162,9 +162,9 @@ fluent.syntax==0.18.1 \ # -r requirements-mach-vendor-python.in # compare-locales # fluent.migrate -glean_parser==4.4.0 \ - --hash=sha256:3ae1435b183936a49368806421df27ab944f1802e86a02b38b8e08e53ff0aac5 \ - --hash=sha256:948a2b3c81270564a33251fc8ecbfe48bf0549f74bc2d5a8027f6d7b1abae828 +glean_parser==5.0.1 \ + --hash=sha256:309f36ed55f2f1ed82472ab8b18e1dd01edeb71060464e3f859c9b60e38b87d4 \ + --hash=sha256:7357aac9a857883db99121abb15b9fdb9bcb5437cecee28c9b8a09a2123408ed # via -r requirements-mach-vendor-python.in idna-ssl==1.1.0 \ --hash=sha256:a933e3bb13da54383f9e8f35dc4f9cb9eb9b3b78c6b36f311254d6d0d92c6c7c diff --git a/third_party/rust/glean-core/.cargo-checksum.json b/third_party/rust/glean-core/.cargo-checksum.json index e3ccc9c5c5db..378fdb550dfd 100644 --- a/third_party/rust/glean-core/.cargo-checksum.json +++ b/third_party/rust/glean-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"5b2421440f4986bd35405b0c3a154f285f27f4c338cdb3401c42f32f4a90ef75","Cargo.toml":"bc4f752cc239c32137408eafb8b34ee054f1ef10db9ea27707c4f0817d9473bc","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","examples/sample.rs":"05469332ffa58c661628eb2f260dfd59085c371b0ef0f8b6e9cb77c230b9bb04","src/common_metric_data.rs":"0ce52740ab6d880df5127336ced68be30da568cd2a94301dc16d4e3f527134c9","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"458e3c8af2af5345e02dea32b36f7521d4428c2ea65c225337008af56d00c6f6","src/debug.rs":"90158cc5d488ba67b60d06647e54e59a1d7bdeb906087e4fe4cfab4373c1cc6c","src/error.rs":"97172a791efdf8b791a04ae7961085fbef4391b313ff3ffb24e9381f2901fccc","src/error_recording.rs":"42af60683cb30eba821b955fe156ce43a114c0f6f3f3b5b84566659398137671","src/event_database/mod.rs":"95d665a039236ede25dd479b19f0ddc32c0dd79cef2fbcc2ef3bab1540680276","src/histogram/exponential.rs":"389d48bab03f7229445ee4d4c8a4c49f6b43303f658dc954da75142f3c040dc6","src/histogram/functional.rs":"1a63a305b48bcef7bc38136b40d916df4bb8f098dc602514ada54a9b091f6951","src/histogram/linear.rs":"5642c8983c3c1ce9b69c6ac99133c8ed5e67abe2398c5dbcf67e69d66880f4ca","src/histogram/mod.rs":"11e5d3b6440a33a3e5544d0e03ffd69fa2fdcabe603ad75e0327f3ed548e8ce3","src/internal_metrics.rs":"b4e2bb7917fc6b031b604300c1fee17f6ee3c1658052289201d8e0f95f220e49","src/internal_pings.rs":"5ed4669b6f09d660401f44c8279e0a5fea0262e48de40e85595bd25dc70b05f3","src/lib.rs":"62711d00fea14e89daa03d0f67e54915f570f2160b8ae430929bd8c347b3fb6b","src/lib_unit_tests.rs":"d74c558b2296a34e786e3af2f46eb9ecfea6da94ea496aa0341d308a58ade4bb","src/macros.rs":"3f3fc8c36dd05b7528b66b27e95b6494505a7a1f48abd013218de23ada6b5a43","src/metrics/boolean.rs":"49e2f5be78055f61543db1d4d57cc06064a812a8f45c9d0e753df8325edc9041","src/metrics/counter.rs":"e3e2a195b597ea1559991b992f44a8a5f291b592a5c6946e93e01066f276efbb","src/metrics/custom_distribution.rs":"7ea1c54802e15bb490fdc8b396998ec474bfca2f135902a4028a9530fbb5dd98","src/metrics/datetime.rs":"1a89be75bb6c9092893fcb4e7272865b0abefd1b5d1ebe8a9bd685043804cff4","src/metrics/denominator.rs":"511e4123779a6d9159bb0911069f7dcb979899a0fae0d200da854685b59d3348","src/metrics/event.rs":"d6e4a52dbde7fbd44c21df567508c35acf046e08c6ea593bbb65fa25223a2b40","src/metrics/experiment.rs":"3f3ede015bb63fd5f71fc6a90421b25d8002faf71c0766b27bf59b5ae8b8d0da","src/metrics/jwe.rs":"8e1c2e204c285a428cf58f0e7d7ee0662294208b6b48706658a6f44cf412575a","src/metrics/labeled.rs":"e77459b593b2b6b375a1dacb1c9192fb47dcb5a294935c2c30aeea8e6f5432cd","src/metrics/memory_distribution.rs":"c2d75dfe9f67a21087b36af64816e703e6b56551b970fac642552116af97f2b5","src/metrics/memory_unit.rs":"d7a678e5242febd021283b30c0099a9e62729944816a3f17d2d91e2808bc0570","src/metrics/mod.rs":"069b6790de4abcaeb8ec06797a1e85344baff6b86844508b2d75d67eb00dc5d5","src/metrics/ping.rs":"b9d344cbfdbe8aff99a83423bd0af465a7228b503f92fe912ddac24904f4eca9","src/metrics/quantity.rs":"2eb6e34f7b0a292df26cddb4295bca7b82557320eff157bf854822c4a7fccb7e","src/metrics/rate.rs":"ba297a593d340568ee1f8061a6ba4f8970220ab2a83c7af290393538c6dd9bc4","src/metrics/string.rs":"8b47de25d4354c9ccf71a5558b287241a4d80c5832ac82e280543bb800996f54","src/metrics/string_list.rs":"c956616cfd1d0fce3c2e61f0b054235f455db2295d128f08b3db2ddcdd11bdbe","src/metrics/time_unit.rs":"9bb3f6c03b1d385008b254f36ed35daf22f9a6fa2d18e007c9b70aac767cde50","src/metrics/timespan.rs":"1252babc991f8c79cbd5027f3a332c28eb63fb0a956d19a18c670ab4f2e60ba3","src/metrics/timing_distribution.rs":"b885514ef2e84c970403f85bcdb09a24abf9822dbd78129fba9d37de388520a8","src/metrics/url.rs":"b83b1de16d2397fa31e52855ccc024a050c0b429af8ffb3ff1519b68b923241d","src/metrics/uuid.rs":"ebe5560fcc76b230d304172f0ab69dc3f5e41924dad8aa30090bd38b103d0ade","src/ping/mod.rs":"33f0270af5f6946bae6367162ed8df5966da8735054da31bd26e738fcb29c91b","src/scheduler.rs":"e4b5355366c5cdd9aedd6bd1114fe0bd0d7b9dcbe5366293374b3006ffc1c01b","src/storage/mod.rs":"265e0ff9f3b769f6167afd6e498760c0505fe8431f52fb84f377b20b2b15670e","src/system.rs":"2e2a7436075bd1a34c118202a4d18e58236947696ce3d824e97d9c06ddf0c171","src/traits/boolean.rs":"f17f16f379b777e435e38e810e25336a919f4aeeefb1b4e7cf7749c0ef173fd9","src/traits/counter.rs":"631208036059d498a4485c74c2a80c24a5f13bffeb1053bdf5cce06af0e9d361","src/traits/custom_distribution.rs":"1b3ffda6e857bfa8ad5be412e88f3d9706ededf5a86407364ae19a81f06ef798","src/traits/datetime.rs":"2f4b9e64161c15c912b6a915045dd9840f76229d144a4d1542c54eb4f3b3406b","src/traits/event.rs":"ce9a9395748734b241f35b31c4cddf0ce6a8eca6d700aaeea427b0ae29ce507d","src/traits/jwe.rs":"80cdc61e6d99d7c05139c9d05288290c731b1be61afcbd4a4c415973665ea194","src/traits/labeled.rs":"7f3281fc0a1a745238e7e260463f397dfa61717408fe9d260dc9767d9c659e52","src/traits/memory_distribution.rs":"0b72ffde68eb97f01a57afbc5c6109565ec9435561984d34696622bf5a57d559","src/traits/mod.rs":"88cec83fcff8dfab768953b901ee95fed186f7540afdc9606407aff71f1919df","src/traits/numerator.rs":"9690a1b4487521565bd488e9a938aa66f93045c63f0f0ee6e864e0341395659b","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"087d7a4b58f0eb7c766a0202dcf38a52d172ce4edf626211ffe5d94ed02ae754","src/traits/rate.rs":"9d0da25895d4c43cdece43dd57e515ab2fb907e8c9a239807976e3d9197d2955","src/traits/string.rs":"48e5623c7db59b8e6454fbc7fb6e2395f808c9a0fa721d7c07b72abb171eb1ad","src/traits/string_list.rs":"5d5773d5a130323dd82ca95f4ecdccdd6b237afe2eadf8655363bd6b7e8508c1","src/traits/timespan.rs":"29251233847c5cdd200a61472132c62ded27fe2c13835b09424384bf144d82db","src/traits/timing_distribution.rs":"5e619d445e6ef3f19ca69bcdfe02d19b150c5a46855d195703b6d2f55e538636","src/traits/url.rs":"a01331623af4fa8af6e71becffff60060832bef5e48a15df6dc23b41225f689e","src/traits/uuid.rs":"bd78515611ba406d8b1bda35a9fe30c317512a9afcea7c5dece8fced7d410a92","src/upload/directory.rs":"8e40804f60f72c33b2727722eeab1a752c6d0f7a43b0340f8a45b2d65cd34601","src/upload/mod.rs":"34bcb67a5980e2c8b5145553b83e130ed4db40dab6d5c53bc9978469e6b93223","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"7939e77bde4b55263446c3660b6831bafa27308bc983a51e1679321e962f372f","src/upload/result.rs":"d73454e81f185e4e28c887f7b496bffad7baac74c8f1b719885f940f909a530d","src/util.rs":"c1ecfc1037406d5b10aa185dac4ae28c6a8de603958a5b4969bb1bf130759985","tests/boolean.rs":"9f4830f3b5f5ab6768060917deb1f546324a4744b8ed893197e31a0aed092947","tests/common/mod.rs":"28c77637c5e75a6a57c0aeb4b082de1b5d8015d507b557ca365aa5adbf208af8","tests/counter.rs":"39a2cd40335c164b3e7407f5505bbf571d7e4a71f032d476a7939f7dd1af90d0","tests/custom_distribution.rs":"596575504ad4eab2765b5b88245dcc92dc68e83d04c93deb4b27692c142c0b94","tests/datetime.rs":"4b4ab629a0f0ae789416b67f0efdfe1142fdb18f9d3a0b5182d8d840e4a6655c","tests/event.rs":"cb78dfc0a2315253da8ef6663b81979dd5b0638bb6c31456f16ce4e9bb50c67a","tests/jwe.rs":"dc8a73d1e1925ac49061e8bb5c8de01230aa364942a22470e37aa88965b0eaba","tests/labeled.rs":"cedd548bd8089dfa316cfdfaa1985fb5cd1294e6ba5956b6012c3f01975e8de9","tests/memory_distribution.rs":"0c03d0a491150f508dc12ecac7e5db70043f3a7de2f90cc6b3509aba90549821","tests/metrics.rs":"0560e0645321628015610bbf1a90c0adbb12ad42e5a068399073572120377cbb","tests/ping.rs":"a15c619b2d3c70c3cb669d02b959109bcf231440bdcfe3cac7508a3e310cd181","tests/ping_maker.rs":"aa7921c9dcea278003c719136eeea9b711d0be12bf736cc9a79b70b69cf6109f","tests/quantity.rs":"2543f0f57085d27b0bc0c25c24c17a7e376ac673cf9265a3a9dec202920679c5","tests/storage.rs":"d8d50aba92e17a3053fd80788f5fbbcc8f82293c11c19b58e2de6c4ee45f71ff","tests/string.rs":"9c3e21bfa3ad0b75373f8f5addb8ac023ac5336ac9f969e92b89ea6fda675fdd","tests/string_list.rs":"2b83710b949bea4bd0f6b2029069887f3ea87312b00091e5aa3c7bda0fb9073c","tests/timespan.rs":"bb61e4cfb843b3f387378409ee1a88ef4b8f32b2181af686baacee262b8bca2b","tests/timing_distribution.rs":"78305508227d2be94e056f1716f545a9505ede8e763da5f1a2297b546a9d7307","tests/uuid.rs":"cf0df9e330344c6e00cd51faaf21dc74c5e47f892b525e0f83623c92a6378be8"},"package":"6078d68e763d57610d362f34223f856fff64d8d3b1c8974833c9fa02a971f59c"} \ No newline at end of file +{"files":{"Cargo.lock":"e34aa1d20df6ec67d632f8dfc9d51fb48f5903afdff8e05bff8e3129c02e2390","Cargo.toml":"56f19a1916a38b30822b7e391170f2fd23be069a522f8939fd60998e9126779f","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","examples/sample.rs":"05469332ffa58c661628eb2f260dfd59085c371b0ef0f8b6e9cb77c230b9bb04","src/common_metric_data.rs":"0ce52740ab6d880df5127336ced68be30da568cd2a94301dc16d4e3f527134c9","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"458e3c8af2af5345e02dea32b36f7521d4428c2ea65c225337008af56d00c6f6","src/debug.rs":"90158cc5d488ba67b60d06647e54e59a1d7bdeb906087e4fe4cfab4373c1cc6c","src/error.rs":"97172a791efdf8b791a04ae7961085fbef4391b313ff3ffb24e9381f2901fccc","src/error_recording.rs":"42af60683cb30eba821b955fe156ce43a114c0f6f3f3b5b84566659398137671","src/event_database/mod.rs":"95d665a039236ede25dd479b19f0ddc32c0dd79cef2fbcc2ef3bab1540680276","src/histogram/exponential.rs":"389d48bab03f7229445ee4d4c8a4c49f6b43303f658dc954da75142f3c040dc6","src/histogram/functional.rs":"1a63a305b48bcef7bc38136b40d916df4bb8f098dc602514ada54a9b091f6951","src/histogram/linear.rs":"5642c8983c3c1ce9b69c6ac99133c8ed5e67abe2398c5dbcf67e69d66880f4ca","src/histogram/mod.rs":"11e5d3b6440a33a3e5544d0e03ffd69fa2fdcabe603ad75e0327f3ed548e8ce3","src/internal_metrics.rs":"b4e2bb7917fc6b031b604300c1fee17f6ee3c1658052289201d8e0f95f220e49","src/internal_pings.rs":"5ed4669b6f09d660401f44c8279e0a5fea0262e48de40e85595bd25dc70b05f3","src/lib.rs":"62711d00fea14e89daa03d0f67e54915f570f2160b8ae430929bd8c347b3fb6b","src/lib_unit_tests.rs":"d74c558b2296a34e786e3af2f46eb9ecfea6da94ea496aa0341d308a58ade4bb","src/macros.rs":"3f3fc8c36dd05b7528b66b27e95b6494505a7a1f48abd013218de23ada6b5a43","src/metrics/boolean.rs":"49e2f5be78055f61543db1d4d57cc06064a812a8f45c9d0e753df8325edc9041","src/metrics/counter.rs":"e3e2a195b597ea1559991b992f44a8a5f291b592a5c6946e93e01066f276efbb","src/metrics/custom_distribution.rs":"7ea1c54802e15bb490fdc8b396998ec474bfca2f135902a4028a9530fbb5dd98","src/metrics/datetime.rs":"1a89be75bb6c9092893fcb4e7272865b0abefd1b5d1ebe8a9bd685043804cff4","src/metrics/denominator.rs":"511e4123779a6d9159bb0911069f7dcb979899a0fae0d200da854685b59d3348","src/metrics/event.rs":"d6e4a52dbde7fbd44c21df567508c35acf046e08c6ea593bbb65fa25223a2b40","src/metrics/experiment.rs":"3f3ede015bb63fd5f71fc6a90421b25d8002faf71c0766b27bf59b5ae8b8d0da","src/metrics/jwe.rs":"8e1c2e204c285a428cf58f0e7d7ee0662294208b6b48706658a6f44cf412575a","src/metrics/labeled.rs":"e77459b593b2b6b375a1dacb1c9192fb47dcb5a294935c2c30aeea8e6f5432cd","src/metrics/memory_distribution.rs":"c2d75dfe9f67a21087b36af64816e703e6b56551b970fac642552116af97f2b5","src/metrics/memory_unit.rs":"d7a678e5242febd021283b30c0099a9e62729944816a3f17d2d91e2808bc0570","src/metrics/mod.rs":"069b6790de4abcaeb8ec06797a1e85344baff6b86844508b2d75d67eb00dc5d5","src/metrics/ping.rs":"b9d344cbfdbe8aff99a83423bd0af465a7228b503f92fe912ddac24904f4eca9","src/metrics/quantity.rs":"2eb6e34f7b0a292df26cddb4295bca7b82557320eff157bf854822c4a7fccb7e","src/metrics/rate.rs":"ba297a593d340568ee1f8061a6ba4f8970220ab2a83c7af290393538c6dd9bc4","src/metrics/string.rs":"8b47de25d4354c9ccf71a5558b287241a4d80c5832ac82e280543bb800996f54","src/metrics/string_list.rs":"c956616cfd1d0fce3c2e61f0b054235f455db2295d128f08b3db2ddcdd11bdbe","src/metrics/time_unit.rs":"9bb3f6c03b1d385008b254f36ed35daf22f9a6fa2d18e007c9b70aac767cde50","src/metrics/timespan.rs":"1252babc991f8c79cbd5027f3a332c28eb63fb0a956d19a18c670ab4f2e60ba3","src/metrics/timing_distribution.rs":"b885514ef2e84c970403f85bcdb09a24abf9822dbd78129fba9d37de388520a8","src/metrics/url.rs":"b83b1de16d2397fa31e52855ccc024a050c0b429af8ffb3ff1519b68b923241d","src/metrics/uuid.rs":"ebe5560fcc76b230d304172f0ab69dc3f5e41924dad8aa30090bd38b103d0ade","src/ping/mod.rs":"33f0270af5f6946bae6367162ed8df5966da8735054da31bd26e738fcb29c91b","src/scheduler.rs":"e4b5355366c5cdd9aedd6bd1114fe0bd0d7b9dcbe5366293374b3006ffc1c01b","src/storage/mod.rs":"265e0ff9f3b769f6167afd6e498760c0505fe8431f52fb84f377b20b2b15670e","src/system.rs":"2e2a7436075bd1a34c118202a4d18e58236947696ce3d824e97d9c06ddf0c171","src/traits/boolean.rs":"f17f16f379b777e435e38e810e25336a919f4aeeefb1b4e7cf7749c0ef173fd9","src/traits/counter.rs":"631208036059d498a4485c74c2a80c24a5f13bffeb1053bdf5cce06af0e9d361","src/traits/custom_distribution.rs":"1b3ffda6e857bfa8ad5be412e88f3d9706ededf5a86407364ae19a81f06ef798","src/traits/datetime.rs":"2f4b9e64161c15c912b6a915045dd9840f76229d144a4d1542c54eb4f3b3406b","src/traits/event.rs":"ce9a9395748734b241f35b31c4cddf0ce6a8eca6d700aaeea427b0ae29ce507d","src/traits/jwe.rs":"80cdc61e6d99d7c05139c9d05288290c731b1be61afcbd4a4c415973665ea194","src/traits/labeled.rs":"7f3281fc0a1a745238e7e260463f397dfa61717408fe9d260dc9767d9c659e52","src/traits/memory_distribution.rs":"0b72ffde68eb97f01a57afbc5c6109565ec9435561984d34696622bf5a57d559","src/traits/mod.rs":"88cec83fcff8dfab768953b901ee95fed186f7540afdc9606407aff71f1919df","src/traits/numerator.rs":"9690a1b4487521565bd488e9a938aa66f93045c63f0f0ee6e864e0341395659b","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"087d7a4b58f0eb7c766a0202dcf38a52d172ce4edf626211ffe5d94ed02ae754","src/traits/rate.rs":"9d0da25895d4c43cdece43dd57e515ab2fb907e8c9a239807976e3d9197d2955","src/traits/string.rs":"48e5623c7db59b8e6454fbc7fb6e2395f808c9a0fa721d7c07b72abb171eb1ad","src/traits/string_list.rs":"5d5773d5a130323dd82ca95f4ecdccdd6b237afe2eadf8655363bd6b7e8508c1","src/traits/timespan.rs":"29251233847c5cdd200a61472132c62ded27fe2c13835b09424384bf144d82db","src/traits/timing_distribution.rs":"5e619d445e6ef3f19ca69bcdfe02d19b150c5a46855d195703b6d2f55e538636","src/traits/url.rs":"a01331623af4fa8af6e71becffff60060832bef5e48a15df6dc23b41225f689e","src/traits/uuid.rs":"bd78515611ba406d8b1bda35a9fe30c317512a9afcea7c5dece8fced7d410a92","src/upload/directory.rs":"8e40804f60f72c33b2727722eeab1a752c6d0f7a43b0340f8a45b2d65cd34601","src/upload/mod.rs":"34bcb67a5980e2c8b5145553b83e130ed4db40dab6d5c53bc9978469e6b93223","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"7939e77bde4b55263446c3660b6831bafa27308bc983a51e1679321e962f372f","src/upload/result.rs":"d73454e81f185e4e28c887f7b496bffad7baac74c8f1b719885f940f909a530d","src/util.rs":"c1ecfc1037406d5b10aa185dac4ae28c6a8de603958a5b4969bb1bf130759985","tests/boolean.rs":"9f4830f3b5f5ab6768060917deb1f546324a4744b8ed893197e31a0aed092947","tests/common/mod.rs":"28c77637c5e75a6a57c0aeb4b082de1b5d8015d507b557ca365aa5adbf208af8","tests/counter.rs":"39a2cd40335c164b3e7407f5505bbf571d7e4a71f032d476a7939f7dd1af90d0","tests/custom_distribution.rs":"596575504ad4eab2765b5b88245dcc92dc68e83d04c93deb4b27692c142c0b94","tests/datetime.rs":"4b4ab629a0f0ae789416b67f0efdfe1142fdb18f9d3a0b5182d8d840e4a6655c","tests/event.rs":"cb78dfc0a2315253da8ef6663b81979dd5b0638bb6c31456f16ce4e9bb50c67a","tests/jwe.rs":"dc8a73d1e1925ac49061e8bb5c8de01230aa364942a22470e37aa88965b0eaba","tests/labeled.rs":"cedd548bd8089dfa316cfdfaa1985fb5cd1294e6ba5956b6012c3f01975e8de9","tests/memory_distribution.rs":"0c03d0a491150f508dc12ecac7e5db70043f3a7de2f90cc6b3509aba90549821","tests/metrics.rs":"0560e0645321628015610bbf1a90c0adbb12ad42e5a068399073572120377cbb","tests/ping.rs":"a15c619b2d3c70c3cb669d02b959109bcf231440bdcfe3cac7508a3e310cd181","tests/ping_maker.rs":"aa7921c9dcea278003c719136eeea9b711d0be12bf736cc9a79b70b69cf6109f","tests/quantity.rs":"2543f0f57085d27b0bc0c25c24c17a7e376ac673cf9265a3a9dec202920679c5","tests/storage.rs":"d8d50aba92e17a3053fd80788f5fbbcc8f82293c11c19b58e2de6c4ee45f71ff","tests/string.rs":"9c3e21bfa3ad0b75373f8f5addb8ac023ac5336ac9f969e92b89ea6fda675fdd","tests/string_list.rs":"2b83710b949bea4bd0f6b2029069887f3ea87312b00091e5aa3c7bda0fb9073c","tests/timespan.rs":"bb61e4cfb843b3f387378409ee1a88ef4b8f32b2181af686baacee262b8bca2b","tests/timing_distribution.rs":"78305508227d2be94e056f1716f545a9505ede8e763da5f1a2297b546a9d7307","tests/uuid.rs":"cf0df9e330344c6e00cd51faaf21dc74c5e47f892b525e0f83623c92a6378be8"},"package":"7b26fe58cf3ba06a2902239e5c26511a1269e57d61214870837b0ac968332616"} \ No newline at end of file diff --git a/third_party/rust/glean-core/Cargo.lock b/third_party/rust/glean-core/Cargo.lock index 547e3acfd99d..bf85b07aa591 100644 --- a/third_party/rust/glean-core/Cargo.lock +++ b/third_party/rust/glean-core/Cargo.lock @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bincode" @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -163,7 +163,7 @@ dependencies = [ [[package]] name = "glean-core" -version = "43.0.2" +version = "44.0.0" dependencies = [ "bincode", "chrono", @@ -247,9 +247,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.112" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" [[package]] name = "lmdb-rkv" @@ -265,9 +265,9 @@ dependencies = [ [[package]] name = "lmdb-rkv-sys" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b27470ac25167b3afdfb6af8fcd3bc1be67de50ffbdaf4073378cfded6ae24a5" +checksum = "61b9ce6b3be08acefa3003c57b7565377432a89ec24476bbe72e11d101f852fe" dependencies = [ "cc", "libc", @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] @@ -460,18 +460,18 @@ checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "serde" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -480,9 +480,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c059c05b48c5c0067d4b4b2b4f0732dd65feb52daf7e0ea09cd87e7dadc1af79" +checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" dependencies = [ "itoa", "ryu", @@ -491,9 +491,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", diff --git a/third_party/rust/glean-core/Cargo.toml b/third_party/rust/glean-core/Cargo.toml index 161c681048d0..7e28eed63f3a 100644 --- a/third_party/rust/glean-core/Cargo.toml +++ b/third_party/rust/glean-core/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "glean-core" -version = "43.0.2" +version = "44.0.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] include = ["/README.md", "/LICENSE", "/src", "/examples", "/tests", "/Cargo.toml"] description = "A modern Telemetry library" @@ -21,7 +21,7 @@ keywords = ["telemetry"] license = "MPL-2.0" repository = "https://github.com/mozilla/glean" [package.metadata.glean] -glean-parser = "4.4.0" +glean-parser = "5.0.1" [dependencies.bincode] version = "1.2.1" diff --git a/third_party/rust/glean-ffi/.cargo-checksum.json b/third_party/rust/glean-ffi/.cargo-checksum.json index 4f27b8e434a9..53ae5fe84259 100644 --- a/third_party/rust/glean-ffi/.cargo-checksum.json +++ b/third_party/rust/glean-ffi/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"c200013c760171403ce1aad530f51936b053f2db0e7d36c0a84b6d9068374968","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"bfe00cc2501c9b15d5bc463c6db30ebbf8d7b5d6c555cf3827ae529fc9e7d6cc","cbindgen.toml":"ac25d1bc2ab7d6afaf25cfa0d35233f93b01f7129088cdd1fa89b9d987a8c564","glean.h":"bbe571147f9fee34f7deac1057c541f00523317328e591446d4c96bbe84c99eb","src/boolean.rs":"0d1d59d0c13cdb63592a9513f2abcf3d1a8260d6523cc7d1af40cfcb4c75572a","src/byte_buffer.rs":"eeb6df25da7b393517f0c993e1e99a0acbccd7678b1127ce0e471d0e53a4bb45","src/counter.rs":"4d8f41285e4a9dbfa2733cdf937905006b475c0af7a501df73fde4ca77818e82","src/custom_distribution.rs":"b0b3b23289e413e7d150e8dae8217e6bd409cbbab68abb127f146041bcbfaf45","src/datetime.rs":"a5c1c993605b1a8ff044d88de4f4a385aff1a781cb8cb45573b90882da801fae","src/event.rs":"ef6dd4f0493ae223e4f7091d5779e46b33ea9864c2a4e5953811a7d9e8884c32","src/fd_logger.rs":"0f8197bb086f49413cca30a72bae029f663842fc3b78ceef6d0854a070b1cdfd","src/ffi_string_ext.rs":"389ae94dcdace1f56ca2c87207e865edda6d42da45733f1027e0a4dcfa86c492","src/from_raw.rs":"b17515a58d7e303ee746ea54c1c1c6d0523dc4de0bd8157dfaba2a610da637bb","src/handlemap_ext.rs":"3b1b088a2de197a0c3eaae0f2f0915d53602f51c13d27f48297f52cd885d5abc","src/jwe.rs":"72adff64900ca16d6527e8d6a436ac2ba85f738d6e92e33f3d71df32b485d0c3","src/labeled.rs":"9cc706511961dbe62350d62b39e9b2c3a9c9e9f53d5577274e273c0f826cd8c3","src/lib.rs":"b5bee8a36a3d0e32eaa01caad0ca57f8649b61b0f99cd3df1f697c27ec9fc47a","src/macros.rs":"e11614edb156552617354d7f6120c8e60ffeb6632ebc19d2b7c6c3e88523b01b","src/memory_distribution.rs":"08ef15e340f2e7ab2f4f83cd8e883c864d4affb94458e80198c106393bfb6bd8","src/ping_type.rs":"6401bcf4342ec1e4ba3782e2b67b3320aa96c9eddc03fc3c75ecc54e2f08a619","src/quantity.rs":"f72781ea642b5f7e363e9fecaded143d1afd772575603763543f1df3448ec337","src/string.rs":"199a238f3524eb36643d82b63df5c7f013adedb6af80632a2675f8562f34e692","src/string_list.rs":"12e2fbbdc08a1b8da1885fb14acd59ab27c8b598a24dc15a4eaca16636540a54","src/timespan.rs":"b7ac51dbfd5169d8c688c3fd2db51e38b6173c925ca14d7b0e8353f225b30a50","src/timing_distribution.rs":"4b5962729fb0b4c9ebf65a5fc5af105357652fcc282c6f8840f328452ba86ac6","src/upload.rs":"320c6e97df0a87040d2a269765401cd67da50f0a226c95a9a314f22452116f7c","src/url.rs":"2dfaf006cd4024ee07eb37dc312201b027d774f6c9881e556774cc09077a6290","src/uuid.rs":"c9ea7225fac53b55a8aeef39cd33470228c0a178185aa74b8fa652657994e404","src/weak.rs":"0199f4ef38d667f0b9f8ef3c5505ff15cd6e911bc83c27e7e9954fdffe1be0bb"},"package":"a33681c61cb007b4d4c19b3cac1a8e74b211f7afe88f179328c04a3bc72ec466"} \ No newline at end of file +{"files":{"Cargo.toml":"a850e273cc805ce2b1c281d88362e26e0cc85ea53d93685e7642339450b32559","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"bfe00cc2501c9b15d5bc463c6db30ebbf8d7b5d6c555cf3827ae529fc9e7d6cc","cbindgen.toml":"ac25d1bc2ab7d6afaf25cfa0d35233f93b01f7129088cdd1fa89b9d987a8c564","glean.h":"bbe571147f9fee34f7deac1057c541f00523317328e591446d4c96bbe84c99eb","src/boolean.rs":"0d1d59d0c13cdb63592a9513f2abcf3d1a8260d6523cc7d1af40cfcb4c75572a","src/byte_buffer.rs":"eeb6df25da7b393517f0c993e1e99a0acbccd7678b1127ce0e471d0e53a4bb45","src/counter.rs":"4d8f41285e4a9dbfa2733cdf937905006b475c0af7a501df73fde4ca77818e82","src/custom_distribution.rs":"b0b3b23289e413e7d150e8dae8217e6bd409cbbab68abb127f146041bcbfaf45","src/datetime.rs":"a5c1c993605b1a8ff044d88de4f4a385aff1a781cb8cb45573b90882da801fae","src/event.rs":"ef6dd4f0493ae223e4f7091d5779e46b33ea9864c2a4e5953811a7d9e8884c32","src/fd_logger.rs":"0f8197bb086f49413cca30a72bae029f663842fc3b78ceef6d0854a070b1cdfd","src/ffi_string_ext.rs":"389ae94dcdace1f56ca2c87207e865edda6d42da45733f1027e0a4dcfa86c492","src/from_raw.rs":"b17515a58d7e303ee746ea54c1c1c6d0523dc4de0bd8157dfaba2a610da637bb","src/handlemap_ext.rs":"3b1b088a2de197a0c3eaae0f2f0915d53602f51c13d27f48297f52cd885d5abc","src/jwe.rs":"72adff64900ca16d6527e8d6a436ac2ba85f738d6e92e33f3d71df32b485d0c3","src/labeled.rs":"9cc706511961dbe62350d62b39e9b2c3a9c9e9f53d5577274e273c0f826cd8c3","src/lib.rs":"b5bee8a36a3d0e32eaa01caad0ca57f8649b61b0f99cd3df1f697c27ec9fc47a","src/macros.rs":"e11614edb156552617354d7f6120c8e60ffeb6632ebc19d2b7c6c3e88523b01b","src/memory_distribution.rs":"08ef15e340f2e7ab2f4f83cd8e883c864d4affb94458e80198c106393bfb6bd8","src/ping_type.rs":"6401bcf4342ec1e4ba3782e2b67b3320aa96c9eddc03fc3c75ecc54e2f08a619","src/quantity.rs":"f72781ea642b5f7e363e9fecaded143d1afd772575603763543f1df3448ec337","src/string.rs":"199a238f3524eb36643d82b63df5c7f013adedb6af80632a2675f8562f34e692","src/string_list.rs":"12e2fbbdc08a1b8da1885fb14acd59ab27c8b598a24dc15a4eaca16636540a54","src/timespan.rs":"b7ac51dbfd5169d8c688c3fd2db51e38b6173c925ca14d7b0e8353f225b30a50","src/timing_distribution.rs":"4b5962729fb0b4c9ebf65a5fc5af105357652fcc282c6f8840f328452ba86ac6","src/upload.rs":"320c6e97df0a87040d2a269765401cd67da50f0a226c95a9a314f22452116f7c","src/url.rs":"2dfaf006cd4024ee07eb37dc312201b027d774f6c9881e556774cc09077a6290","src/uuid.rs":"c9ea7225fac53b55a8aeef39cd33470228c0a178185aa74b8fa652657994e404","src/weak.rs":"0199f4ef38d667f0b9f8ef3c5505ff15cd6e911bc83c27e7e9954fdffe1be0bb"},"package":"30511afa692ca3764711da025e0bcd8f07dd09271d9885ee70fa4c970fe91e41"} \ No newline at end of file diff --git a/third_party/rust/glean-ffi/Cargo.toml b/third_party/rust/glean-ffi/Cargo.toml index 5f29124b68f3..df5e626d5f29 100644 --- a/third_party/rust/glean-ffi/Cargo.toml +++ b/third_party/rust/glean-ffi/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "glean-ffi" -version = "43.0.2" +version = "44.0.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] include = ["/README.md", "/LICENSE", "/src", "/tests", "/Cargo.toml", "/cbindgen.toml", "/glean.h"] description = "FFI layer for Glean, a modern Telemetry library" @@ -28,7 +28,7 @@ crate-type = ["lib"] version = "0.4.0" [dependencies.glean-core] -version = "43.0.2" +version = "44.0.0" [dependencies.log] version = "0.4.8" diff --git a/third_party/rust/glean/.cargo-checksum.json b/third_party/rust/glean/.cargo-checksum.json index ef459f422a72..056de7a1d00c 100644 --- a/third_party/rust/glean/.cargo-checksum.json +++ b/third_party/rust/glean/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"5bb22247135b1f2966f8045dc205b2559a95768507d3bee4b2d4e77fd071f446","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"fd9e0ca6907917ea6bec5de05e15dd21d20fae1cb7f3250467bb20231a8e1065","src/common_test.rs":"bd7ab2f6384bea8971f97ba68b11c946899303891bc534898f7aabbf27f9008a","src/configuration.rs":"4acbedba16d45f6404ccedde86e8aa33eea8c1b9554210cb69c79ff2ec9040c9","src/core_metrics.rs":"0593192ec0fa1b4d267411cdfb75c70f78578083eca91f6e09cd08346de32264","src/dispatcher/global.rs":"460ccfec311163b469c54f63f4cb41e057b93421ccb7675e435c2994d478cd4b","src/dispatcher/mod.rs":"9f59e466fbbcc3e1bdc42659822a2a2c4b8250456858ee885e53b16458f4a47e","src/glean_metrics.rs":"d376e4f40ec620ce31667451a78adc1146213016e100c0d457505ec240ab31bf","src/lib.rs":"5ecf8102426bbfbd941a7e19bb79a65485a90d9842783a1940c42ebdec61e183","src/net/http_uploader.rs":"9e8c1837ca0d3f6ea165ec936ab054173c4fe95a958710176c33b4d4d1d98beb","src/net/mod.rs":"284bcf182156c52ea25fa33bcc48d80b4970ee3c187a4ea3a06602cc34c710bf","src/pings.rs":"02a3ddb4e77d2033fb5a8fc9bbec09ad5500691e0bd2a1db334805cba88670fd","src/private/boolean.rs":"eeadc0529e2c69a930479f208746799b064b27facab8306c1c10c650e83fb63c","src/private/counter.rs":"0bc8a2d0df72e47b7365ff80bfc16427a5da701fd0adadeedbcce13cebcd79ce","src/private/custom_distribution.rs":"6d1271fb91e9d51a8dcf5eb9d540b3757ebe9cc998b196943ed8c729f62afc67","src/private/datetime.rs":"cb8f26f74d318e2118d6ae1b15972557eb205d4d8b24795fb0d08fdea2bc3f56","src/private/denominator.rs":"95332737f3ac80346f4811440a2141cd427692819bd04d5d3ac7374299dc20b0","src/private/event.rs":"b674ceb85351b7989bd25ed4f5d98c5c9b31e2a03f13b054a8c0dbef54190e49","src/private/labeled.rs":"2cd90d132954ee3ada43ff1ad538072ba43eece7a53ed89811a2a7b43a4819f1","src/private/memory_distribution.rs":"8b78a0e33601081d76639445c8b4875a4fe7c3aded720bb43afdabe86e0fd6ee","src/private/mod.rs":"63368b123fecb6de210ec634b8d387799b4b9dd960016335ebc3c6851e81628f","src/private/numerator.rs":"334ac2ad3d8dd7b9f02f1ca5391b683d50fbc8c6728a12882a68bb067604c800","src/private/ping.rs":"915fc42994e0929656daee5511946ac1f56fe0d4d704e97e13795771d9890180","src/private/quantity.rs":"528675cd388010b89e6ac23c9152701c78d32c2dcd0b5e9abf1a50a52ee818a5","src/private/rate.rs":"7ddfdb3d5f2d1887b378caa3769ade92ea0fbd193f6e760f5f383c8b3e9f3aff","src/private/recorded_experiment_data.rs":"66b2601902a2dc2b7a283717c21ce754de94fcca30d12e0398195c8ad49c90af","src/private/string.rs":"c85ded40b1409793ae5b78da692bc2e708f8d55defb76ec5f515096d32f206c9","src/private/string_list.rs":"472ad79fba4b9bcde0ff5b3e05fd8e0aaa3d1d2941fc181faf2ceb90f1d518bd","src/private/timespan.rs":"19ed08aa5103b685a3a0b9f06f2c60250d55f3c8f36337f8c7bdbb2dfdb92786","src/private/timing_distribution.rs":"ee7fa0c3d5427e371b5413373cb1f5841ac10df9b7ca08316ef724e7ad3591d9","src/private/url.rs":"223de8a025e2f749255103402eecb5582961c2b5af7492e294362a0e8f55c414","src/private/uuid.rs":"2b69ddaf3978aaa31c625c0f3eb948c44369744334aacc6b5a2b217268d244a7","src/system.rs":"ff23a5b94f52dab484342dfed702412bc29ab1bbfd5af326033d8e07e7b9075f","src/test.rs":"0cbe4f51fa01b1ca04e4b726e8eb729c3504086bc6b0d644e2114a5a4473165a","tests/common/mod.rs":"4837df2e771929cc077e6fb9a9239645e8e0f7bc6c9f409b71c4d147edf334fc","tests/init_fails.rs":"1e832fe454962ddb1155d546bb71b6395aa9936f848ff0fbe88affaaab7dfae3","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"4d61e4196d8eef23f3bcb24b59bd0b0379c1f2cb50f03434a53996ab097bfb17","tests/overflowing_preinit.rs":"be7e9a7984162da33f17a5edae29e1e07e5d0b27e8830f7f32bb238a7e788638","tests/persist_ping_lifetime.rs":"adfab91baf978f464e265eae828fcc03aa6eef83422d3918ffb680b2c2ec859e","tests/persist_ping_lifetime_nopanic.rs":"92f4739b21c0d46cb368eafea43bfb822d8dee96412d5f4fc32e01636f0cf244","tests/schema.rs":"621caef0cc7f98c79740422835485fea2343ca105d0d9a7eec6ded9cfad6232c","tests/simple.rs":"2f58d3ff90005231f2febd21f66ee41d06302618408ea990b446510449c3444f"},"package":"5eee21709bc0417a5e2b8ea436717bba01c6851111d3ac096994efa73bb79dab"} \ No newline at end of file +{"files":{"Cargo.toml":"87d83d11f397667c67c48fbf31cd627028f038e48b22060f57c8e49761216127","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"fd9e0ca6907917ea6bec5de05e15dd21d20fae1cb7f3250467bb20231a8e1065","src/common_test.rs":"bd7ab2f6384bea8971f97ba68b11c946899303891bc534898f7aabbf27f9008a","src/configuration.rs":"4acbedba16d45f6404ccedde86e8aa33eea8c1b9554210cb69c79ff2ec9040c9","src/core_metrics.rs":"0593192ec0fa1b4d267411cdfb75c70f78578083eca91f6e09cd08346de32264","src/dispatcher/global.rs":"460ccfec311163b469c54f63f4cb41e057b93421ccb7675e435c2994d478cd4b","src/dispatcher/mod.rs":"9f59e466fbbcc3e1bdc42659822a2a2c4b8250456858ee885e53b16458f4a47e","src/glean_metrics.rs":"d376e4f40ec620ce31667451a78adc1146213016e100c0d457505ec240ab31bf","src/lib.rs":"a2e01d4ef103d0bdc73215e8cff2d48766a8853a6dcb1635bed3b0421861336d","src/net/http_uploader.rs":"9e8c1837ca0d3f6ea165ec936ab054173c4fe95a958710176c33b4d4d1d98beb","src/net/mod.rs":"284bcf182156c52ea25fa33bcc48d80b4970ee3c187a4ea3a06602cc34c710bf","src/pings.rs":"02a3ddb4e77d2033fb5a8fc9bbec09ad5500691e0bd2a1db334805cba88670fd","src/private/boolean.rs":"eeadc0529e2c69a930479f208746799b064b27facab8306c1c10c650e83fb63c","src/private/counter.rs":"0bc8a2d0df72e47b7365ff80bfc16427a5da701fd0adadeedbcce13cebcd79ce","src/private/custom_distribution.rs":"6d1271fb91e9d51a8dcf5eb9d540b3757ebe9cc998b196943ed8c729f62afc67","src/private/datetime.rs":"cb8f26f74d318e2118d6ae1b15972557eb205d4d8b24795fb0d08fdea2bc3f56","src/private/denominator.rs":"95332737f3ac80346f4811440a2141cd427692819bd04d5d3ac7374299dc20b0","src/private/event.rs":"b674ceb85351b7989bd25ed4f5d98c5c9b31e2a03f13b054a8c0dbef54190e49","src/private/labeled.rs":"2cd90d132954ee3ada43ff1ad538072ba43eece7a53ed89811a2a7b43a4819f1","src/private/memory_distribution.rs":"8b78a0e33601081d76639445c8b4875a4fe7c3aded720bb43afdabe86e0fd6ee","src/private/mod.rs":"63368b123fecb6de210ec634b8d387799b4b9dd960016335ebc3c6851e81628f","src/private/numerator.rs":"334ac2ad3d8dd7b9f02f1ca5391b683d50fbc8c6728a12882a68bb067604c800","src/private/ping.rs":"915fc42994e0929656daee5511946ac1f56fe0d4d704e97e13795771d9890180","src/private/quantity.rs":"528675cd388010b89e6ac23c9152701c78d32c2dcd0b5e9abf1a50a52ee818a5","src/private/rate.rs":"7ddfdb3d5f2d1887b378caa3769ade92ea0fbd193f6e760f5f383c8b3e9f3aff","src/private/recorded_experiment_data.rs":"66b2601902a2dc2b7a283717c21ce754de94fcca30d12e0398195c8ad49c90af","src/private/string.rs":"c85ded40b1409793ae5b78da692bc2e708f8d55defb76ec5f515096d32f206c9","src/private/string_list.rs":"472ad79fba4b9bcde0ff5b3e05fd8e0aaa3d1d2941fc181faf2ceb90f1d518bd","src/private/timespan.rs":"19ed08aa5103b685a3a0b9f06f2c60250d55f3c8f36337f8c7bdbb2dfdb92786","src/private/timing_distribution.rs":"ee7fa0c3d5427e371b5413373cb1f5841ac10df9b7ca08316ef724e7ad3591d9","src/private/url.rs":"223de8a025e2f749255103402eecb5582961c2b5af7492e294362a0e8f55c414","src/private/uuid.rs":"2b69ddaf3978aaa31c625c0f3eb948c44369744334aacc6b5a2b217268d244a7","src/system.rs":"ff23a5b94f52dab484342dfed702412bc29ab1bbfd5af326033d8e07e7b9075f","src/test.rs":"0cbe4f51fa01b1ca04e4b726e8eb729c3504086bc6b0d644e2114a5a4473165a","tests/common/mod.rs":"4837df2e771929cc077e6fb9a9239645e8e0f7bc6c9f409b71c4d147edf334fc","tests/init_fails.rs":"1e832fe454962ddb1155d546bb71b6395aa9936f848ff0fbe88affaaab7dfae3","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"4d61e4196d8eef23f3bcb24b59bd0b0379c1f2cb50f03434a53996ab097bfb17","tests/overflowing_preinit.rs":"be7e9a7984162da33f17a5edae29e1e07e5d0b27e8830f7f32bb238a7e788638","tests/persist_ping_lifetime.rs":"adfab91baf978f464e265eae828fcc03aa6eef83422d3918ffb680b2c2ec859e","tests/persist_ping_lifetime_nopanic.rs":"92f4739b21c0d46cb368eafea43bfb822d8dee96412d5f4fc32e01636f0cf244","tests/schema.rs":"621caef0cc7f98c79740422835485fea2343ca105d0d9a7eec6ded9cfad6232c","tests/simple.rs":"2f58d3ff90005231f2febd21f66ee41d06302618408ea990b446510449c3444f"},"package":"d39b68297fbdd3a9cf37243ab30913542cfce546b4c58a5cd7f4ee9cd9ab3d02"} \ No newline at end of file diff --git a/third_party/rust/glean/Cargo.toml b/third_party/rust/glean/Cargo.toml index f7a4f65f3431..14f44e6d7b80 100644 --- a/third_party/rust/glean/Cargo.toml +++ b/third_party/rust/glean/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "glean" -version = "43.0.2" +version = "44.0.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] include = ["/README.md", "/LICENSE", "/src", "/tests", "/Cargo.toml"] description = "Glean SDK Rust language bindings" @@ -28,7 +28,7 @@ features = ["serde"] version = "0.5" [dependencies.glean-core] -version = "43.0.2" +version = "44.0.0" [dependencies.inherent] version = "0.1.4" diff --git a/third_party/rust/glean/src/lib.rs b/third_party/rust/glean/src/lib.rs index 2ba4af61c6b0..a5394494f53c 100644 --- a/third_party/rust/glean/src/lib.rs +++ b/third_party/rust/glean/src/lib.rs @@ -39,10 +39,10 @@ //! prototype_ping.submit(None); //! ``` -use once_cell::sync::OnceCell; +use once_cell::sync::{Lazy, OnceCell}; use std::collections::HashMap; use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::Mutex; +use std::sync::{Arc, Mutex}; pub use configuration::Configuration; use configuration::DEFAULT_GLEAN_ENDPOINT; @@ -101,6 +101,12 @@ static PRE_INIT_PING_REGISTRATION: OnceCell>> = Onc /// Requires a Mutex, because in tests we can actual reset this. static STATE: OnceCell> = OnceCell::new(); +/// Global singleton of the handles of the glean.init threads. +/// For joining. For tests. +/// (Why a Vec? There might be more than one concurrent call to initialize.) +static INIT_HANDLES: Lazy>>>> = + Lazy::new(|| Arc::new(Mutex::new(Vec::new()))); + /// Get a reference to the global state object. /// /// Panics if no global state object was set. @@ -173,16 +179,9 @@ fn launch_with_glean_mut(callback: impl FnOnce(&mut Glean) + Send + 'static) { /// * `client_info` - the [`ClientInfoMetrics`] values used to set Glean /// core metrics. pub fn initialize(cfg: Configuration, client_info: ClientInfoMetrics) { - initialize_internal(cfg, client_info); -} - -fn initialize_internal( - cfg: Configuration, - client_info: ClientInfoMetrics, -) -> Option> { if was_initialize_called() { log::error!("Glean should not be initialized multiple times"); - return None; + return; } let init_handle = std::thread::Builder::new() @@ -351,10 +350,21 @@ fn initialize_internal( }) .expect("Failed to spawn Glean's init thread"); + // For test purposes, store the glean init thread's JoinHandle. + INIT_HANDLES.lock().unwrap().push(init_handle); + // Mark the initialization as called: this needs to happen outside of the // dispatched block! INITIALIZE_CALLED.store(true, Ordering::SeqCst); - Some(init_handle) +} + +/// TEST ONLY FUNCTION +/// Waits on all the glean.init threads' join handles. +pub fn join_init() { + let mut handles = INIT_HANDLES.lock().unwrap(); + for handle in handles.drain(..) { + handle.join().unwrap(); + } } /// Shuts down Glean in an orderly fashion. @@ -668,6 +678,9 @@ pub fn test_get_experiment_data(experiment_id: String) -> RecordedExperimentData pub(crate) fn destroy_glean(clear_stores: bool) { // Destroy the existing glean instance from glean-core. if was_initialize_called() { + // Just because initialize was called doesn't mean it's done. + join_init(); + // Reset the dispatcher first (it might still run tasks against the database) dispatcher::reset_dispatcher(); @@ -709,9 +722,8 @@ pub(crate) fn destroy_glean(clear_stores: bool) { pub fn test_reset_glean(cfg: Configuration, client_info: ClientInfoMetrics, clear_stores: bool) { destroy_glean(clear_stores); - if let Some(handle) = initialize_internal(cfg, client_info) { - handle.join().unwrap(); - } + initialize(cfg, client_info); + join_init(); } /// Sets a debug view tag. diff --git a/toolkit/components/glean/Cargo.toml b/toolkit/components/glean/Cargo.toml index d1a0ba602e54..b0bf5bfac919 100644 --- a/toolkit/components/glean/Cargo.toml +++ b/toolkit/components/glean/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "MPL-2.0" [dependencies] -glean = { version = "43.0.2", features = ["rkv-safe-mode"] } +glean = { version = "44.0.0", features = ["rkv-safe-mode"] } # In theory we only need this for `target_os = "android"` builds. # Cargo has the ability to do that with `[target.'cfg(target_os = "android")'.dependencies]`. # However that seems to confuse `cbindgen` quite a lot; @@ -15,7 +15,7 @@ glean = { version = "43.0.2", features = ["rkv-safe-mode"] } # So for now we unconditionally depend on it, but in the code we only `extern crate` it on Android builds. # While `glean-ffi` is still built (I think it is), # it's not linked into the final library. -glean-ffi = "43.0.2" +glean-ffi = "44.0.0" log = "0.4" nserror = { path = "../../../xpcom/rust/nserror" } nsstring = { path = "../../../xpcom/rust/nsstring" } diff --git a/toolkit/components/glean/api/Cargo.toml b/toolkit/components/glean/api/Cargo.toml index 544003dcc70b..dd5b143c5358 100644 --- a/toolkit/components/glean/api/Cargo.toml +++ b/toolkit/components/glean/api/Cargo.toml @@ -8,7 +8,7 @@ publish = false [dependencies] bincode = "1.0" chrono = "0.4.10" -glean = "43.0.2" +glean = "44.0.0" inherent = "0.1.4" log = "0.4" nsstring = { path = "../../../../xpcom/rust/nsstring", optional = true }