Skip to content

Commit

Permalink
Link to metrics in Data Catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
Linh authored and Iinh committed Apr 18, 2024
1 parent bb46ec4 commit f1d37e3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/pages/MetricDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
updateURLState,
updateBreadcrumbs,
} from "../state/stores";
import { getBigQueryURL, getMetricSearchURL } from "../state/urls";
import {
getBigQueryURL,
getDataCatalogMetricURL,
getMetricSearchURL,
} from "../state/urls";
import { getAppBreadcrumbs } from "./AppDetail.svelte";
import { isExpired, isRemoved, isRecent } from "../state/items";
Expand Down Expand Up @@ -484,12 +488,12 @@
>{pingData.bigquery_table}</a
>
and <AuthenticatedLink
href={`https://mozilla.acryl.io/dataset/urn:li:dataset:(urn:li:dataPlatform:bigquery,mozdata.${params.app}.${selectedPingVariant.id},PROD)`}
href={`https://mozilla.acryl.io/dataset/urn:li:dataset:(urn:li:dataPlatform:bigquery,mozdata.${params.app}.${selectedPingVariant.id.replace(/[\.-]/g, "_")},PROD)`}
label="{params.app}.{selectedPingVariant.id}"
type="MetricDetail.Access.BigQuery.Union.TableURL"
>{pingData.bigquery_table}
>
{params.app}.{selectedPingVariant.id}
{params.app}.{selectedPingVariant.id.replace(/[\.-]/g, "_")}
<HelpHoverable
content={"The result table of UNION-ing all the per-app_id datasets."}
link={"https://github.com/mozilla/bigquery-etl/tree/main/sql_generators/glean_usage#glean-usage"}
Expand Down Expand Up @@ -528,6 +532,25 @@
</div>
</td>
</tr>
<tr>
<td>
Data Catalog
<HelpHoverable
content={"View this metric in Mozilla's instance of DataHub"}
/>
</td>
<td>
<AuthenticatedLink
href={getDataCatalogMetricURL(
selectedAppVariant.id,
selectedPingVariant.id,
selectedAppVariant.etl.bigquery_column_name
)}
>
{selectedAppVariant.etl.bigquery_column_name}
</AuthenticatedLink>
</td>
</tr>
<tr>
<td>
STMO
Expand Down
12 changes: 12 additions & 0 deletions src/state/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ export function getBigQueryURL(appName, appId, pingName, metricName) {
export function getMetricSearchURL(app, search) {
return `/apps/${app}?search=${search}`;
}

export function getDataCatalogMetricURL(appId, pingId, bigQueryColumn) {
const DATA_CATALOG_URL = "https://mozilla.acryl.io";
// We want to link to stable tables because that's what's mostly used in ETL downstream
return `${DATA_CATALOG_URL}/dataset/urn:li:dataset:(urn:li:dataPlatform:bigquery,moz-fx-data-shared-prod.${appId.replace(
/\./g,
"_"
)}_stable.${pingId.replace(
/[\.-]/g,
"_"
)}_v1,PROD)/Lineage?column=${bigQueryColumn}`;
}

0 comments on commit f1d37e3

Please sign in to comment.