in etl/firefox_legacy_etl.py [0:0]
def _get_legacy_firefox_metric_summary(probe_data, activity_mapping):
"""
Get a summary of legacy firefox metrics, which we can use as a search index
"""
probe_summary = {}
for probe_id, probe in probe_data.items():
if probe["type"] == "event":
# let's just skip legacy firefox events, since we're just doing
# this for GLAM's benefit (which doesn't display events)
continue
if probe["history"].get("nightly"):
most_recent_metadata = probe["history"]["nightly"][0]
else:
most_recent_metadata = probe["history"]["beta"][0]
normalized_probe_name = probe["name"].lower().replace(".", "_")
if probe_id.startswith("scalar/"):
# scalar names are camelCased, but we want snake_case
# to match the convention used in bigquery-etl
# see: https://github.com/mozilla/glam/issues/1956
normalized_probe_name = snake_case(probe_id.split("/")[1]).lower().replace(".", "_")
probe_summary[normalized_probe_name] = {
"name": normalized_probe_name,
"id": probe_id,
"type": probe["type"],
"description": most_recent_metadata["description"],
"bug_numbers": most_recent_metadata["bug_numbers"],
"details": most_recent_metadata["details"],
"optout": most_recent_metadata["optout"],
"kind": most_recent_metadata["details"]["kind"],
"versions": {
channel: channel_data[0]["versions"]
for (channel, channel_data) in probe["history"].items()
},
"active": normalized_probe_name in activity_mapping,
"seen_in_processes": activity_mapping.get(normalized_probe_name, []),
}
if most_recent_metadata["details"].get("labels") is not None:
probe_summary[normalized_probe_name]["labels"] = most_recent_metadata["details"][
"labels"
]
return probe_summary