Skip to content

Commit

Permalink
feat: remove dau_reporting ping as we decided it should not be includ…
Browse files Browse the repository at this point in the history
…ed in the usage_reporting derived tables
  • Loading branch information
kik-kik committed Dec 11, 2024
1 parent 0a92d91 commit 303a4bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 68 deletions.
1 change: 0 additions & 1 deletion sql_generators/glean_usage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def table_names_from_baseline(baseline_table, include_project_id=True):
events_view=f"{prefix}.events",
events_stream_table=f"{prefix}_derived.events_stream_v1",
events_stream_view=f"{prefix}.events_stream",
dau_reporting_stable_table=f"{prefix}_stable.dau_reporting_v1",
usage_reporting_stable_table=f"{prefix}_stable.usage_reporting_v1",
usage_reporting_clients_daily_table=f"{prefix}_derived.usage_reporting_clients_daily_v1",
usage_reporting_clients_first_seen_table=f"{prefix}_derived.usage_reporting_clients_first_seen_v1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,54 +34,6 @@ WITH usage_reporting_base AS (
{% endif %}
{% endraw %}
AND metrics.uuid.usage_profile_id IS NOT NULL
),
dau_reporting_base AS (
SELECT
submission_timestamp,
DATE(submission_timestamp) AS submission_date,
metrics.uuid.usage_profile_id,
normalized_channel,
-- client_info.app_display_version,
-- client_info.app_build,
normalized_os,
normalized_os_version,
-- client_info.locale,
normalized_country_code,
{% if has_distribution_id %}
metrics.string.metrics_distribution_id AS distribution_id,
{% else %}
CAST(NULL AS STRING) AS distribution_id,
{% endif %}
{% if "_desktop" in app_name %}
COALESCE(metrics.counter.browser_engagement_uri_count, 0) AS browser_engagement_uri_count,
COALESCE(metrics.counter.browser_engagement_active_ticks, 0) AS browser_engagement_active_ticks,
{% endif %}
CAST(NULL AS BOOLEAN) AS is_active,
-- SAFE.PARSE_DATE('%F', SUBSTR(client_info.first_run_date, 1, 10)) AS first_run_date,
FROM
`{{ project_id }}.{{ dau_reporting_stable_table }}`
WHERE
{% raw %}
{% if is_init() %}
DATE(submission_timestamp) >= '2024-10-10'
{% else %}
DATE(submission_timestamp) = @submission_date
{% endif %}
{% endraw %}
AND metrics.uuid.usage_profile_id IS NOT NULL
),
-- We need to union with the old dau_reporting ping here as we want to make sure we include data
-- from clients that take longer to update.
reporting_pings_union AS (
SELECT
*,
"usage_reporting" AS source_ping_name,
FROM usage_reporting_base
UNION ALL
SELECT
*,
"dau_reporting" AS source_ping_name,
FROM dau_reporting_base
)
SELECT
submission_date,
Expand All @@ -98,11 +50,8 @@ SELECT
-- Eventually is_active value will come from the client.
COALESCE(LOGICAL_OR(is_active), TRUE) AS is_active,
{% endif %}
STRUCT(
ARRAY_AGG(DISTINCT source_ping_name) AS source_pings
),
FROM
reporting_pings_union
usage_reporting_base
GROUP BY
submission_date,
usage_profile_id
10 changes: 5 additions & 5 deletions sql_generators/glean_usage/usage_reporting_clients_daily.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Generating and run dau_reporting_clients_daily queries for Glean apps."""
"""Generating and run usage_reporting_clients_daily queries for Glean apps."""

from sql_generators.glean_usage.common import GleanTable

TARGET_TABLE_ID = "dau_reporting_clients_daily_v1"
PREFIX = "dau_reporting_clients_daily"
TARGET_TABLE_ID = "usage_reporting_clients_daily_v1"
PREFIX = "usage_reporting_clients_daily"


class UsageReportingClientsDailyTable(GleanTable):
"""Represents generated dau_reporting_clients_daily table."""
"""Represents generated usage_reporting_clients_daily table."""

def __init__(self):
"""Initialize dau_reporting_clients_daily table."""
"""Initialize usage_reporting_clients_daily table."""
GleanTable.__init__(self)
self.target_table_id = TARGET_TABLE_ID
self.prefix = PREFIX
Expand Down
10 changes: 5 additions & 5 deletions sql_generators/glean_usage/usage_reporting_clients_first_seen.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Generating and run dau_reporting_clients_first_seen queries for Glean apps."""
"""Generating and run usage_reporting_clients_first_seen queries for Glean apps."""

from sql_generators.glean_usage.common import GleanTable

TARGET_TABLE_ID = "dau_reporting_clients_first_seen_v1"
PREFIX = "dau_reporting_clients_first_seen"
TARGET_TABLE_ID = "usage_reporting_clients_first_seen_v1"
PREFIX = "usage_reporting_clients_first_seen"


class UsageReportingClientsFirstSeenTable(GleanTable):
"""Represents generated dau_reporting_clients_first_seen table."""
"""Represents generated usage_reporting_clients_first_seen table."""

def __init__(self):
"""Initialize dau_reporting_clients_first_seen table."""
"""Initialize usage_reporting_clients_first_seen table."""
GleanTable.__init__(self)
self.target_table_id = TARGET_TABLE_ID
self.prefix = PREFIX
Expand Down
10 changes: 5 additions & 5 deletions sql_generators/glean_usage/usage_reporting_clients_last_seen.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Generating and run dau_reporting_clients_last_seen queries for Glean apps."""
"""Generating and run usage_reporting_clients_last_seen queries for Glean apps."""

from sql_generators.glean_usage.common import GleanTable

TARGET_TABLE_ID = "dau_reporting_clients_last_seen_v1"
PREFIX = "dau_reporting_clients_last_seen"
TARGET_TABLE_ID = "usage_reporting_clients_last_seen_v1"
PREFIX = "usage_reporting_clients_last_seen"


class UsageReportingClientsLastSeenTable(GleanTable):
"""Represents generated dau_reporting_clients_last_seen table."""
"""Represents generated usage_reporting_clients_last_seen table."""

def __init__(self):
"""Initialize dau_reporting_clients_last_seen table."""
"""Initialize usage_reporting_clients_last_seen table."""
GleanTable.__init__(self)
self.target_table_id = TARGET_TABLE_ID
self.prefix = PREFIX
Expand Down

0 comments on commit 303a4bf

Please sign in to comment.