Skip to content

Commit

Permalink
Fixes #2021 - Metric detail sampling info "undefined" sample rate (#2022
Browse files Browse the repository at this point in the history
)
  • Loading branch information
travis79 authored Dec 1, 2023
1 parent 0d5b619 commit f3c1597
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions etl/glean_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,19 @@ def write_glean_metadata(output_dir, functions_dir, app_names=None):
)
is_sampled = metric_sample_info is not None

sampled_text = "Not sampled"
if is_sampled:
if metric_sample_info.get("release") is not None:
for channel in metric_sample_info:
sampled_text = "Not sampled"
sampled_text = (
str(metric_sample_info.get("release")["sample_size"] * 100)
str(metric_sample_info.get(channel)["sample_size"] * 100)
+ "% "
+ "on"
if metric.definition["disabled"] is True
else str(metric_sample_info.get("release")["sample_size"] * 100)
else str(metric_sample_info.get(channel)["sample_size"] * 100)
+ "% "
+ "off"
)
metric_sample_info["release"]["sampled_text"] = sampled_text
metric_sample_info.get(channel)["sampled_text"] = sampled_text

base_definition = _incorporate_annotation(
dict(
Expand All @@ -416,7 +416,9 @@ def write_glean_metadata(output_dir, functions_dir, app_names=None):
metric.definition["expires"], app_name, product_details
),
sampled=is_sampled,
sampled_text=sampled_text,
sampled_text=(metric_sample_info.get("release")["sampled_text"])
if metric_sample_info is not None
else "Not sampled",
),
metric_annotation,
)
Expand Down

0 comments on commit f3c1597

Please sign in to comment.