From b7b0fbab5e40762c40a3bf01a9a39f8575225a2d Mon Sep 17 00:00:00 2001 From: kik-kik <42538694+kik-kik@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:12:52 +0100 Subject: [PATCH] tweak(): making the active_users_aggregates checks more lenient (#4714) * making the active_users_aggregates checks more lenient * reformated sql generator templates for active users checks * implementing lucia-vargas-a feedback from PR#4714 --- .../active_users/templates/desktop_checks.sql | 28 ++++++++++++++++--- .../active_users/templates/fenix_checks.sql | 14 ++++++++-- .../active_users/templates/mobile_checks.sql | 14 ++++++++-- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/sql_generators/active_users/templates/desktop_checks.sql b/sql_generators/active_users/templates/desktop_checks.sql index 2c24e9b5f8..a5888d1c8c 100644 --- a/sql_generators/active_users/templates/desktop_checks.sql +++ b/sql_generators/active_users/templates/desktop_checks.sql @@ -94,8 +94,18 @@ live_table_qdau_count AS ( ) SELECT IF( - (SELECT * FROM live_table_qdau_count) <> (SELECT * FROM qdau_sum), - ERROR("QDAU mismatch between aggregates table and live table"), + ABS((SELECT * FROM qdau_sum) - (SELECT * FROM live_table_qdau_count)) > 10, + ERROR( + CONCAT( + "QDAU mismatch between the live (`telemetry_live.main_v5`) and active_users_aggregates (`{{ dataset_id }}.{{ table_name }}`) tables is greated than 10.", + " Live table count: ", + (SELECT * FROM live_table_qdau_count), + " | active_users_aggregates (QDAU): ", + (SELECT * FROM qdau_sum), + " | Delta detected: ", + ABS((SELECT * FROM qdau_sum) - (SELECT * FROM live_table_qdau_count)) + ) + ), NULL ); @@ -142,8 +152,18 @@ distinct_client_count AS ( ) SELECT IF( - ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) > 1, - ERROR("DAU mismatch between aggregates table and live table"), + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) > 10, + ERROR( + CONCAT( + "DAU mismatch between the live (`telemetry_live.main_v5`) and active_users_aggregates (`{{ dataset_id }}.{{ table_name }}`) tables is greated than 10.", + " Live table count: ", + (SELECT * FROM distinct_client_count), + " | active_users_aggregates (DAU): ", + (SELECT * FROM dau_sum), + " | Delta detected: ", + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) + ) + ), NULL ); diff --git a/sql_generators/active_users/templates/fenix_checks.sql b/sql_generators/active_users/templates/fenix_checks.sql index e90c1748d6..019e90177f 100644 --- a/sql_generators/active_users/templates/fenix_checks.sql +++ b/sql_generators/active_users/templates/fenix_checks.sql @@ -121,8 +121,18 @@ distinct_client_count AS ( ) SELECT IF( - ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) > 1, - ERROR("DAU mismatch between aggregates table and live table"), + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) > 10, + ERROR( + CONCAT( + "DAU mismatch between the firefox_ios live (`org_mozilla_firefox_live`, `org_mozilla_fenix_live.baseline_v1`,`org_mozilla_firefox_beta_live.baseline_v1`,`org_mozilla_fenix_nightly_live.baseline_v1`, `org_mozilla_fennec_aurora_live.baseline_v1`) and active_users_aggregates (`fenix_derived.active_users_aggregates_v2`) tables is greated than 10.", + " Live table count: ", + (SELECT * FROM distinct_client_count), + " | active_users_aggregates (DAU): ", + (SELECT * FROM dau_sum), + " | Delta detected: ", + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) + ) + ), NULL ); diff --git a/sql_generators/active_users/templates/mobile_checks.sql b/sql_generators/active_users/templates/mobile_checks.sql index 7b54be4902..b1763281f5 100644 --- a/sql_generators/active_users/templates/mobile_checks.sql +++ b/sql_generators/active_users/templates/mobile_checks.sql @@ -43,7 +43,17 @@ distinct_client_count AS ( ) SELECT IF( - (SELECT * FROM dau_sum) <> (SELECT * FROM distinct_client_count), - ERROR("DAU mismatch between aggregates table and live table"), + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) > 10, + ERROR( + CONCAT( + "DAU mismatch between the {{ app_name }} live across all channels ({%- for channel in channels %}{{ channel.table }},{% endfor -%}) and active_users_aggregates ({%- raw %}`{{ dataset_id }}.{{ table_name }}`{%- endraw %}) tables is greated than 10.", + " Live table count: ", + (SELECT * FROM distinct_client_count), + " | active_users_aggregates (DAU): ", + (SELECT * FROM dau_sum), + " | Delta detected: ", + ABS((SELECT * FROM dau_sum) - (SELECT * FROM distinct_client_count)) + ) + ), NULL );