Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SQL modal and remove Looker link #2740

Merged
merged 3 commits into from
Mar 21, 2024
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
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ jobs:
printf
'{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n'
"$CIRCLE_SHA1" "$CIRCLE_TAG" "$CIRCLE_PROJECT_USERNAME"
"$CIRCLE_PROJECT_REPONAME" "$CIRCLE_BUILD_URL"
> version.json
"$CIRCLE_PROJECT_REPONAME" "$CIRCLE_BUILD_URL" > version.json
- run:
name: Output version.json
command: cat version.json
Expand All @@ -144,7 +143,7 @@ jobs:
tag: $CIRCLE_TAG
registry-url: gcr.io
- gcp-gcr/push-image:
image: auth0-proxy
image: auth0-proxy
registry-url: gcr.io
tag: $CIRCLE_TAG
google-project-id: GOOGLE_PROJECT_ID
Expand Down
63 changes: 52 additions & 11 deletions src/components/SqlModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import desktopTelemetrySql from '../stringTemplates/desktop-telemetry.tpl';
import desktopDistributionSql from '../stringTemplates/desktop-distribution.tpl';
import desktopHistogramProportionsSql from '../stringTemplates/desktop-histogram-proportions.tpl';
import fenixGlamSql from '../stringTemplates/fenix-glam.tpl';
import desktopGlamSql from '../stringTemplates/desktop-glam.tpl';

let sqlElement;
let status;
Expand All @@ -28,6 +30,40 @@
sqlElement.style.transition = '';
}, 500);
}
function getGlamSql() {
const osFilter =
$store.productDimensions.os === '*'
? 'os IS NULL'
: `os="${$store.productDimensions.os}"`;
const buildIdFilter =
$store.productDimensions.aggregationLevel === 'build_id'
? 'app_build_id IS NOT NULL'
: 'app_build_id IS NULL';
const processFilter = $store.productDimensions.process
? `AND process="${$store.productDimensions.process}"`
: '';
return _.template(desktopGlamSql)({
metric: $store.probe.name,
channel: $store.productDimensions.channel,
osFilter,
buildIdFilter,
processFilter,
});
}

function getFenixGlamSql() {
const buildIdFilter =
$store.productDimensions.aggregationLevel === 'build_id'
? 'app_build_id!="*"'
: 'app_build_id="*"';
return _.template(fenixGlamSql)({
app_id: $store.productDimensions.app_id,
metric: $store.probe.name.replace('.', '_'),
os: $store.productDimensions.os,
ping_type: $store.productDimensions.ping_type,
buildIdFilter,
});
}

function getDesktopSql(tpl = 'telemetry') {
// TODO: Use the time horizon to date window in SQL?
Expand Down Expand Up @@ -80,19 +116,25 @@

const tabs = [];
if ($store.product === 'firefox') {
tabs.push({
id: 2,
label: 'GLAM SQL',
sql: getGlamSql,
});
// Telemetry SQL only works on histograms.
if ($store.probe.type === 'histogram') {
tabs.push({
id: 1,
label: 'Telemetry SQL',
sql: getDesktopSql,
});
tabs.push({
id: 2,
label: 'Distribution SQL',
sql: getDesktopSql,
});
}
} else if ($store.product === 'fenix') {
tabs.push({
id: 1,
label: 'GLAM SQL',
sql: getFenixGlamSql,
});
}
</script>

Expand Down Expand Up @@ -202,8 +244,9 @@
<p>Sorry, this feature is not available for Glean metrics yet.</p>
{:else}
<p>
The following SQL query can be copy/pasted and used in the BigQuery
console to explore this data further:
The following SQL query can be copied and used in the BigQuery console
to explore further. Please note that you need internal access to our
analysis tooling to query the data.
</p>
{/if}
<ul>
Expand Down Expand Up @@ -232,10 +275,8 @@
{#each tabs as tab}
{#if activeTab === tab.id}
<pre>
<code bind:this={sqlElement}>
{tab.label.includes('Distribution')
? tab.sql('distribution')
: tab.sql('telemetry')}
<code bind:this={sqlElement}
>{tab.sql()}
</code>
<div class="buttons">
<button class="copy" on:click={copySql} title="Copy to clipboard">
Expand Down
2 changes: 0 additions & 2 deletions src/routing/pages/probe/FirefoxLegacyDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import StatusLabel from '../../../components/StatusLabel.svelte';
import SqlModal from '../../../components/SqlModal.svelte';
import Markdown from '../../../components/Markdown.svelte';
import LookerLink from '../../../components/LookerLink.svelte';

export let showLinks = true;

Expand Down Expand Up @@ -245,7 +244,6 @@
<Brackets size={16} />
Export to JSON
</button>
<LookerLink product="firefox" />
</div>
</div>
{/if}
Expand Down
9 changes: 2 additions & 7 deletions src/routing/pages/probe/GleanDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getBugURL, getBugLinkTitle } from '../../../utils/urls';
import ExternalLink from '../../../components/icons/ExternalLink.svelte';
import StatusLabel from '../../../components/StatusLabel.svelte';
import LookerLink from '../../../components/LookerLink.svelte';
import SqlModal from '../../../components/SqlModal.svelte';

export let showLinks = true;

Expand Down Expand Up @@ -292,16 +292,11 @@
{#if showLinks}
<div class="probe-details-download">
<div class="drawer-section drawer-section--end">
<SqlModal />
<button on:click={exportData} class="docs-button">
<Brackets size={16} />
Export to JSON
</button>
<LookerLink
product="glean"
variants={$store.probe.variants}
sendInPings={$store.productDimensions.ping_type}
channel={$store.productDimensions.app_id}
/>
</div>
</div>
{/if}
Expand Down
20 changes: 20 additions & 0 deletions src/stringTemplates/desktop-glam.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- GLAM public aggregates data for Firefox Desktop Nightly and Beta

SELECT os,
app_version,
app_build_id,
channel,
metric,
metric_type,
KEY,
process,
client_agg_type,
agg_type,
total_users,
mozfun.glam.histogram_cast_json(aggregates) AS aggregates
FROM `mozilla-public-data.glam_derived.client_probe_counts_firefox_desktop_nightly_v1`
-- for `beta` channel data: mozilla-public-data.glam_derived.client_probe_counts_firefox_desktop_beta_v1
WHERE metric="${ metric }"
AND channel="${ channel }"
AND ${ osFilter }
AND ${ buildIdFilter } ${ processFilter }
18 changes: 18 additions & 0 deletions src/stringTemplates/fenix-glam.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- GLAM Fenix aggregates data (note that this is an internal table)

SELECT ping_type,
os,
app_version,
app_build_id,
metric,
metric_type,
KEY,
client_agg_type,
agg_type,
total_users,
mozfun.glam.histogram_cast_json(aggregates) AS aggregates,
FROM `moz-fx-data-shared-prod.glam_etl.org_mozilla_fenix_glam_${ app_id }__view_probe_counts_v1`
WHERE metric="${ metric }"
AND os="${ os }"
AND ping_type="${ ping_type }"
AND ${ buildIdFilter }