forked from mirrors/gecko-dev
Bug 1942797 - Generate a serverknobs config for all uninteresting metrics. r=mkmelin a=pascalc
In certain builds we pass a list of "interesting" metrics. Everything not on that list is marked as disabled. For tests however we want to keep all defined metrics enabled. We use serverknobs to control that. At build time we build a serverknobs config using all "uninteresting" metrics and enable them. This config would then need to be applied at runtime when in tests. Differential Revision: https://phabricator.services.mozilla.com/D242914
This commit is contained in:
parent
c28f1b278b
commit
316d89486f
2 changed files with 64 additions and 0 deletions
|
|
@ -0,0 +1,54 @@
|
|||
# -*- 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/.
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import buildconfig
|
||||
from buildconfig import topsrcdir
|
||||
from run_glean_parser import parse
|
||||
|
||||
|
||||
def main(serverknobs_fd, *args):
|
||||
all_objs, options = parse(args)
|
||||
|
||||
only_interesting = set()
|
||||
interesting_yamls = buildconfig.substs.get("MOZ_GLEAN_INTERESTING_METRICS_FILES")
|
||||
if interesting_yamls:
|
||||
interesting = [os.path.join(topsrcdir, x) for x in interesting_yamls]
|
||||
interesting.append(
|
||||
os.path.join(topsrcdir, "toolkit/components/glean/tags.yaml")
|
||||
)
|
||||
extra_tags_files = buildconfig.substs.get("MOZ_GLEAN_EXTRA_TAGS_FILES")
|
||||
if extra_tags_files:
|
||||
tag_files = [os.path.join(topsrcdir, x) for x in extra_tags_files]
|
||||
interesting.extend(tag_files)
|
||||
|
||||
interesting_metrics, _options = parse(interesting + list(args[1:]))
|
||||
for category_name in interesting_metrics.keys():
|
||||
if category_name in ["pings", "tags"]:
|
||||
continue
|
||||
for name, metric in interesting_metrics[category_name].items():
|
||||
fullname = f"{category_name}.{name}"
|
||||
only_interesting.add(fullname)
|
||||
|
||||
only_uninteresting = {}
|
||||
|
||||
for category_name in all_objs.keys():
|
||||
if category_name in ["pings", "tags"]:
|
||||
continue
|
||||
for name, metric in all_objs[category_name].items():
|
||||
fullname = f"{category_name}.{name}"
|
||||
if fullname not in only_interesting:
|
||||
only_uninteresting[fullname] = True
|
||||
|
||||
config = {"metrics_enabled": only_uninteresting}
|
||||
json.dump(config, serverknobs_fd, sort_keys=True, indent=2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.stdout, *sys.argv[1:])
|
||||
|
|
@ -242,6 +242,16 @@ if CONFIG["MOZ_ARTIFACT_BUILDS"]:
|
|||
# Once generated, it needs to be placed in GreD so it can be found.
|
||||
FINAL_TARGET_FILES += ["!jogfile.json"]
|
||||
|
||||
if CONFIG["MOZ_GLEAN_INTERESTING_METRICS_FILES"]:
|
||||
GeneratedFile(
|
||||
"interesting_serverknobs.json",
|
||||
script="build_scripts/glean_parser_ext/interesting_serverknobs.py",
|
||||
flags=[CONFIG["MOZ_APP_VERSION"]],
|
||||
inputs=["!metrics_yamls.cached"],
|
||||
)
|
||||
# Once generated, it needs to be placed in GreD so it can be found.
|
||||
FINAL_TARGET_FILES += ["!interesting_serverknobs.json"]
|
||||
|
||||
# OHTTP support requires the fog_control crate know which pings wish to be sent
|
||||
# using OHTTP. fog_control has no access to the firefox_on_glean crate, so it
|
||||
# needs its own codegen.
|
||||
|
|
|
|||
Loading…
Reference in a new issue