diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /toolkit/components/glean/build_scripts | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/glean/build_scripts')
6 files changed, 49 insertions, 44 deletions
diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py b/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py index b42827989e..08418bbce5 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py @@ -56,6 +56,8 @@ known_ping_args = [ "send_if_empty", "precise_timestamps", "include_info_sections", + "enabled", + "schedules_pings", "reason_codes", ] diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py b/toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py index bc9f09f0d3..436cca974c 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py @@ -12,7 +12,7 @@ import cpp import jinja2 import jog import rust -from glean_parser import lint, parser, translate, util +from glean_parser import lint, metrics, parser, translate, util from mozbuild.util import FileAvoidWrite, memoize from util import generate_metric_ids @@ -189,6 +189,19 @@ def output_gifft_map(output_fd, probe_type, all_objs, cpp_fd): file=sys.stderr, ) sys.exit(1) + # We only support mirrors for lifetime: ping + # If you understand and are okay with how Legacy Telemetry has no + # mechanism to which to mirror non-ping lifetimes, + # you may use `no_lint: [GIFFT_NON_PING_LIFETIME]` + elif ( + metric.lifetime != metrics.Lifetime.ping + and "GIFFT_NON_PING_LIFETIME" not in metric.no_lint + ): + print( + f"Glean lifetime semantics are not mirrored. {category_name}.{metric.name}'s lifetime of {metric.lifetime} is not supported.", + file=sys.stderr, + ) + sys.exit(1) env = jinja2.Environment( loader=jinja2.PackageLoader("run_glean_parser", "templates"), diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/jog_factory.jinja2 b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/jog_factory.jinja2 index a31bdbabf0..ef2088bec4 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/jog_factory.jinja2 +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/jog_factory.jinja2 @@ -148,10 +148,12 @@ pub fn create_and_register_ping( send_if_empty: bool, precise_timestamps: bool, include_info_sections: bool, + enabled: bool, + schedules_pings: Vec<String>, reason_codes: Vec<String>, ) -> Result<u32, Box<dyn std::error::Error>> { let ping_id = NEXT_PING_ID.fetch_add(1, Ordering::SeqCst); - let ping = Ping::new(ping_name, include_client_id, send_if_empty, precise_timestamps, include_info_sections, reason_codes); + let ping = Ping::new(ping_name, include_client_id, send_if_empty, precise_timestamps, include_info_sections, enabled, schedules_pings, reason_codes); assert!( __jog_metric_maps::PING_MAP.write()?.insert(ping_id.into(), ping).is_none(), "We should never insert a runtime ping with an already-used id." diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust.jinja2 b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust.jinja2 index 5723ff5d58..3b29a0f252 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust.jinja2 +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust.jinja2 @@ -20,10 +20,13 @@ Jinja2 template is not. Please file bugs! #} pub struct {{ name }} { {% for itemname, val in struct.properties.items() %} {% if val.type == "object" %} - pub {{itemname|snake_case}}: {{ name ~ "Item" ~ itemname|Camelize ~ "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", default = "Vec::new")] 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 %} diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust_pings.jinja2 b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust_pings.jinja2 index 8afdae61ae..1a95b8f25c 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust_pings.jinja2 +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/templates/rust_pings.jinja2 @@ -21,6 +21,8 @@ pub static {{ obj.name|snake_case }}: Lazy<Ping> = Lazy::new(|| { {{ obj.send_if_empty|rust }}, {{ obj.precise_timestamps|rust }}, {{ obj.include_info_sections|rust }}, + {{ obj.enabled|rust }}, + {{ obj.schedules_pings|rust }}, {{ obj.reason_codes|rust }}, ) }); diff --git a/toolkit/components/glean/build_scripts/mach_commands.py b/toolkit/components/glean/build_scripts/mach_commands.py index b8d270c088..627f9f3c37 100644 --- a/toolkit/components/glean/build_scripts/mach_commands.py +++ b/toolkit/components/glean/build_scripts/mach_commands.py @@ -15,56 +15,39 @@ GENERATED_HEADER = """ """ -@Command( - "data-review", - category="misc", - description="Generate a skeleton data review request form for a given bug's data", -) -@CommandArgument( - "bug", default=None, nargs="?", type=str, help="bug number or search pattern" -) -def data_review(command_context, bug=None): - # Get the metrics_index's list of metrics indices - # by loading the index as a module. - import sys - from os import path +DATA_REVIEW_HELP = """ +Beginning 2024-05-07[1], data reviews for projects in mozilla-central are now +conducted on Phabricator. Simply duplicate your bug URL from the `bugs` list to +the `data_reviews` list in your metrics and pings definitions, and push for code +review in the normal way[2]. - sys.path.append(path.join(path.dirname(__file__), path.pardir)) - from pathlib import Path +More details about this process can be found in the in-tree docs[3] and wiki[4]. - from glean_parser import data_review - from metrics_index import metrics_yamls +If you'd like to generate a Data Review Request template anyway (if, for +instance, you can't use Phabricator for your data review or you need a Data +Review Request to aid in a Sensitive Data Review process. Or you're just +curious), you can invoke glean_parser directly: - return data_review.generate( - bug, [Path(command_context.topsrcdir) / x for x in metrics_yamls] - ) +./mach python -m glean_parser data-review + +[1]: https://groups.google.com/a/mozilla.org/g/firefox-dev/c/7z-i6UhPoKY +[2]: https://firefox-source-docs.mozilla.org/contributing/index.html +[3]: https://firefox-source-docs.mozilla.org/contributing/data-review.html +[4]: https://wiki.mozilla.org/Data_Collection +""" @Command( - "perf-data-review", + "data-review", category="misc", - description="Generate a skeleton performance data review request form for a given bug's data", -) -@CommandArgument( - "bug", default=None, nargs="?", type=str, help="bug number or search pattern" + description="Describe how Data Review works in mozilla-central", ) -def perf_data_review(command_context, bug=None): - # Get the metrics_index's list of metrics indices - # by loading the index as a module. - import sys - from os import path +def data_review(command_context): + # Data Review happens in Phabricator now + # (https://groups.google.com/a/mozilla.org/g/firefox-dev/c/7z-i6UhPoKY) + # so explain how to do it. - sys.path.append(path.join(path.dirname(__file__), path.pardir)) - from metrics_index import metrics_yamls - - sys.path.append(path.dirname(__file__)) - from pathlib import Path - - import perf_data_review - - return perf_data_review.generate( - bug, [Path(command_context.topsrcdir) / x for x in metrics_yamls] - ) + print(DATA_REVIEW_HELP) @Command( |