Skip to content

Commit

Permalink
Fix #1484: keep only one status per client per source and per period (#…
Browse files Browse the repository at this point in the history
…1487)

* Fix #1484: keep only one status per client and per source

* Remove print() to debug SQL

* 'make format'
  • Loading branch information
leplatrem authored Sep 10, 2024
1 parent 60971c2 commit 70b2f76
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions checks/remotesettings/uptake_error_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
WITH uptake_telemetry AS (
SELECT
client_id,
timestamp AS submission_timestamp,
normalized_channel,
SPLIT(app_version, '.')[OFFSET(0)] AS version,
Expand All @@ -47,6 +48,13 @@
AND event_string_value <> 'up_to_date'
{version_condition}
{channel_condition}
),
-- Enumerate all the statuses reported by a client for each source
row_number_by_client_id AS (
SELECT
ROW_NUMBER() OVER (PARTITION BY client_id, source, status) AS rn,
*
FROM uptake_telemetry
)
SELECT
-- Min/Max timestamps of this period
Expand All @@ -57,8 +65,9 @@
normalized_channel AS channel,
version,
COUNT(*) AS total
FROM uptake_telemetry
WHERE {source_condition}
FROM row_number_by_client_id
WHERE rn = 1 -- Keep only one status per client and per source
AND {source_condition}
GROUP BY period, source, status, channel, version
ORDER BY period, source
"""
Expand Down

0 comments on commit 70b2f76

Please sign in to comment.