-
Notifications
You must be signed in to change notification settings - Fork 104
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
DENG-6880 - Daily aggregations for NewTab #6863
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4330322
DENG-6880 updates to include new fields and aggregations
gkatre 5593c06
adding interactions aggregations
gkatre 5a0d694
removing unwanted aggs
gkatre c95300d
DENG-6880 - Daily aggregations for NewTab
gkatre b58055e
updating schema.yaml
gkatre a5ec6e2
Merge branch 'main' into newtab/DENG-6880-newtab_update_aggregations
gkatre 793aa7b
Update sql/moz-fx-data-shared-prod/telemetry_derived/newtab_condition…
gkatre fa5746a
Adding homepage_category and newtab_category computations
gkatre 4a1f958
formatting
gkatre 7f9e282
Merge branch 'main' into newtab/DENG-6880-newtab_update_aggregations
gkatre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
sql/moz-fx-data-shared-prod/telemetry/newtab_conditional_daily_aggregates/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
friendly_name: Newtab Conditional Daily Aggregates | ||
description: |- | ||
Conditional computations for daily aggregation for newtab. | ||
owners: | ||
- [email protected] |
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/telemetry/newtab_conditional_daily_aggregates/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.telemetry.newtab_conditional_daily_aggregates` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry_derived.newtab_conditional_daily_aggregates_v1` |
5 changes: 5 additions & 0 deletions
5
sql/moz-fx-data-shared-prod/telemetry/newtab_daily_interactions_aggregates/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
friendly_name: Newtab Interactions Daily Aggregates | ||
description: |- | ||
A daily aggregation of newtab interactions, partitioned by day. | ||
owners: | ||
- [email protected] |
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/telemetry/newtab_daily_interactions_aggregates/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.telemetry.newtab_daily_interactions_aggregates` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry_derived.newtab_daily_interactions_aggregates_v1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...x-data-shared-prod/telemetry_derived/newtab_conditional_daily_aggregates_v1/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
friendly_name: Newtab Conditional Daily Aggregates | ||
description: |- | ||
Conditional computations for daily aggregation for newtab. | ||
owners: | ||
- [email protected] | ||
labels: | ||
application: firefox | ||
incremental: true | ||
schedule: daily | ||
dag: bqetl_newtab | ||
owner1: gkatre | ||
scheduling: | ||
dag_name: bqetl_newtab | ||
bigquery: | ||
time_partitioning: | ||
type: day | ||
field: submission_date | ||
require_partition_filter: true | ||
expiration_days: null | ||
clustering: | ||
fields: | ||
- country_code | ||
references: {} |
171 changes: 171 additions & 0 deletions
171
...oz-fx-data-shared-prod/telemetry_derived/newtab_conditional_daily_aggregates_v1/query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
SELECT | ||
submission_date, | ||
country_code, | ||
pocket_enabled, | ||
pocket_sponsored_stories_enabled, | ||
topsites_enabled, | ||
COUNT(DISTINCT client_id) AS total_client_count, | ||
COUNT(DISTINCT newtab_visit_id) AS total_visit_count, | ||
-- conditional | ||
COUNT(DISTINCT IF(channel = 'release', client_id, NULL)) AS client_count, | ||
COUNT(DISTINCT IF(channel = 'release', newtab_visit_id, NULL)) AS visit_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:home' | ||
AND newtab_homepage_category = 'enabled', | ||
client_id, | ||
NULL | ||
) | ||
) AS home_default_client_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:home' | ||
AND newtab_homepage_category = 'enabled', | ||
newtab_visit_id, | ||
NULL | ||
) | ||
) AS home_default_visit_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:newtab' | ||
AND newtab_newtab_category = 'enabled', | ||
client_id, | ||
NULL | ||
) | ||
) AS newtab_default_client_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:newtab' | ||
AND newtab_newtab_category = 'enabled', | ||
newtab_visit_id, | ||
NULL | ||
) | ||
) AS newtab_default_visit_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:home' | ||
AND newtab_homepage_category != 'enabled', | ||
client_id, | ||
NULL | ||
) | ||
) AS home_nondefault_client_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:home' | ||
AND newtab_homepage_category != 'enabled', | ||
newtab_visit_id, | ||
NULL | ||
) | ||
) AS home_nondefault_visit_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:newtab' | ||
AND newtab_newtab_category != 'enabled', | ||
client_id, | ||
NULL | ||
) | ||
) AS newtab_nondefault_client_count, | ||
COUNT( | ||
DISTINCT IF( | ||
channel = 'release' | ||
AND newtab_open_source = 'about:newtab' | ||
AND newtab_newtab_category != 'enabled', | ||
newtab_visit_id, | ||
NULL | ||
) | ||
) AS newtab_nondefault_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND newtab_open_source = 'about:welcome', client_id, NULL) | ||
) AS welcome_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND newtab_open_source = 'about:welcome', newtab_visit_id, NULL) | ||
) AS welcome_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND searches > 0, client_id, NULL) | ||
) AS searched_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND searches > 0, newtab_visit_id, NULL) | ||
) AS searched_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_topsite_impressions > 0, client_id, NULL) | ||
) AS sponsored_topsite_impressed_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_topsite_impressions > 0, newtab_visit_id, NULL) | ||
) AS sponsored_topsite_impressed_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_topsite_clicks > 0, client_id, NULL) | ||
) AS sponsored_topsite_clicked_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_topsite_clicks > 0, newtab_visit_id, NULL) | ||
) AS sponsored_topsite_clicked_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND topsite_impressions > 0, client_id, NULL) | ||
) AS topsite_impressed_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND topsite_impressions > 0, newtab_visit_id, NULL) | ||
) AS topsite_impressed_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND topsite_clicks > 0, client_id, NULL) | ||
) AS topsite_clicked_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND topsite_clicks > 0, newtab_visit_id, NULL) | ||
) AS topsite_clicked_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_pocket_impressions > 0, client_id, NULL) | ||
) AS sponsored_pocket_impressed_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_pocket_impressions > 0, newtab_visit_id, NULL) | ||
) AS sponsored_pocket_impressed_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_pocket_clicks > 0, client_id, NULL) | ||
) AS sponsored_pocket_clicked_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND sponsored_pocket_clicks > 0, newtab_visit_id, NULL) | ||
) AS sponsored_pocket_clicked_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND organic_pocket_impressions > 0, client_id, NULL) | ||
) AS organic_pocket_impressed_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND organic_pocket_impressions > 0, newtab_visit_id, NULL) | ||
) AS organic_pocket_impressed_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND organic_pocket_clicks > 0, client_id, NULL) | ||
) AS organic_pocket_clicked_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND organic_pocket_clicks > 0, newtab_visit_id, NULL) | ||
) AS organic_pocket_clicked_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_impressions > 0, client_id, NULL) | ||
) AS pocket_impressed_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_impressions > 0, newtab_visit_id, NULL) | ||
) AS pocket_impressed_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_clicks > 0, client_id, NULL) | ||
) AS pocket_clicked_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_clicks > 0, newtab_visit_id, NULL) | ||
) AS pocket_clicked_visit_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_is_signed_in, client_id, NULL) | ||
) AS pocket_signed_in_client_count, | ||
COUNT( | ||
DISTINCT IF(channel = 'release' AND pocket_is_signed_in, newtab_visit_id, NULL) | ||
) AS pocket_signed_in_visit_count, | ||
FROM | ||
`moz-fx-data-shared-prod.telemetry_derived.newtab_interactions_v1` | ||
WHERE | ||
submission_date = @submission_date | ||
GROUP BY | ||
submission_date, | ||
country_code, | ||
pocket_enabled, | ||
pocket_sponsored_stories_enabled, | ||
topsites_enabled |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need one for counting just homepage category enabled/disabled independent of source?
Maybe I missed it but I couldn't find.
For this widget: https://mozilla.cloud.looker.com/explore/firefox_desktop/newtab_interactions?qid=qOIDEWK6Oo10MxPDZcg7rn&origin_space=464&toggle=vis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also for this widget with newtab_category: https://mozilla.cloud.looker.com/explore/firefox_desktop/newtab_interactions?qid=L3HcgEzCJWLQBVDaYeVVbg&origin_space=464&toggle=vis
I think due to the count distinct we can't just SUM home vs newtab in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have it here:
Would this work? Or perhaps I could add
newtab_homepage_category
and/ornewtab_newtab_category
to the granularity (GROUP BY) if you feel its ok (that is: we will not end up double counting clients and visits)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was that all aggregations of that field have either
newtab_open_source = 'about:home'
ornewtab_open_source = 'about:newtab'
but the query on the explore doesn't include anything about newtab_open_source and I'm not sure how that affects the numbers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Just to be safe, instead of adding
newtab_homepage_category
andnewtab_newtab_category
as a dimension in the GROUP BY, I will add a set of 2 distinct count metrics:newtab_homepage_category
enablednewtab_newtab_category
enabledThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bani added the aggregates for newtab_homepage_category enabled and newtab_newtab_category enabled