Skip to content

Commit

Permalink
Remove channel specifier from Firefox desktop Looker explore links (f…
Browse files Browse the repository at this point in the history
…ixes #871) (#872)

* Remove channel specifier from Firefox desktop Looker explore links

* make app_channel non optional for now

Co-authored-by: Will Lachance <[email protected]>

* Lint

Co-authored-by: Will Lachance <[email protected]>
  • Loading branch information
Iinh and wlach authored Oct 1, 2021
1 parent 92885b3 commit c7a542e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions scripts/build-glean-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,16 @@ def etl_snake_case(line: str) -> str:
return "_".join([w.lower() for w in words if w.strip()])[::-1]


def get_looker_ping_explore_url(looker_namespaces, app_name, ping_name, table_name):
def get_looker_ping_explore_url(looker_namespaces, app_name, ping_name, table_name, app_channel):
ping_name_snakecase = stringcase.snakecase(ping_name)
if (
looker_namespaces.get(app_name)
and looker_namespaces[app_name].get("glean_app")
and looker_namespaces[app_name]["explores"].get(ping_name_snakecase)
):
channel_identifier = "mozdata." + table_name.replace("_", "%5E_")
return (
f"https://mozilla.cloud.looker.com/explore/{app_name}/{ping_name_snakecase}"
+ f"?f[{ping_name_snakecase}.channel]={channel_identifier}"
return f"https://mozilla.cloud.looker.com/explore/{app_name}/{ping_name_snakecase}?" + (
f"f[{ping_name_snakecase}.channel]={channel_identifier}" if app_channel else ""
)
return None

Expand Down Expand Up @@ -341,7 +340,9 @@ def get_app_variant_description(app):
looker_namespaces, app_name, app.app.get("app_channel")
)
if ping == "events"
else get_looker_ping_explore_url(looker_namespaces, app_name, ping, table_name)
else get_looker_ping_explore_url(
looker_namespaces, app_name, ping, table_name, app.app.get("app_channel")
)
)
# we deliberately don't show looker information for deprecated applications
if not app_is_deprecated and base_looker_explore_link:
Expand Down Expand Up @@ -517,7 +518,11 @@ def get_app_variant_description(app):
else {
"name": ping.identifier,
"url": get_looker_ping_explore_url(
looker_namespaces, app_name, ping.identifier, stable_ping_table_name
looker_namespaces,
app_name,
ping.identifier,
stable_ping_table_name,
app_channel,
),
}
)
Expand Down

0 comments on commit c7a542e

Please sign in to comment.