Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .netlify/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ exports.getSearchFunction = function (metricData, legacy) {
const getScore = legacy
? (item) => {
let score = 0;
// the only criteria for legacy data is if it's "active" or not
score += item.active || item.active === undefined ? 1 : 0;
// for glam searches, glean metrics take precedence over legacy metrics
score += glamMode && item.glean ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: I had to check the table to be certain that && had a higher precedence than the ternary (it does: logical AND is precedence 4, ternary is precedence 2)

return score;
}
: (item) => {
Expand All @@ -75,7 +76,9 @@ exports.getSearchFunction = function (metricData, legacy) {
// if in glam mode, we want to move unsupported metrics right to the bottom
// (do this by adding a higher score to these types of metrics)
score +=
glamMode && SUPPORTED_GLAM_METRIC_TYPES.has(item.type) ? 10 : 0;
glamMode && SUPPORTED_GLAM_METRIC_TYPES.has(item.type) ? 1 : 0;
// for glam searches, glean metrics take precedence over legacy metrics
score += glamMode && item.glean ? 1 : 0;
return score;
};

Expand Down
13 changes: 10 additions & 3 deletions etl/glean_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def write_glean_metadata(output_dir, functions_dir, app_names=None):
)
is_sampled = metric_sample_info is not None

metric_sampled_text = None
if is_sampled:
for channel in metric_sample_info:
sampled_text = (
Expand All @@ -447,11 +448,17 @@ def write_glean_metadata(output_dir, functions_dir, app_names=None):
)
metric_sample_info.get(channel)["sampled_text"] = sampled_text

# We prefer the release channel text, but if it's
# not available, we use the first available
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was failing because there was no "release". So I decided to pick the first one in case, to fix it.

if not metric_sampled_text:
metric_sampled_text = sampled_text
if channel == "release":
metric_sampled_text = sampled_text

# Force all outside metrics as removed.
if app_name in APPS_DEPENDENCIES_REMOVED:
if metric.definition["origin"] != app_name:
metric.definition.update({"in_source": False})

base_definition = _incorporate_annotation(
dict(
name=metric.identifier,
Expand All @@ -470,8 +477,8 @@ def write_glean_metadata(output_dir, functions_dir, app_names=None):
metric.definition["expires"], app_name, product_details
),
sampled=is_sampled,
sampled_text=(metric_sample_info.get("release")["sampled_text"])
if metric_sample_info is not None
sampled_text=metric_sampled_text
if metric_sampled_text
else "Not sampled",
is_part_of_info_section=metric.bq_prefix
in ["client_info", "ping_info"],
Expand Down