Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): stop reporting google play console 503s as errors (#123489)

Tom Owersb1d0d704ee82
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/source.py
index e39388ae63a9..f046a7a58696 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/source.py
@@ -108,11 +108,19 @@ class GooglePlayConsoleSource(ResumableSource[GooglePlayConsoleSourceConfig, Goo
# The Reporting API answers its own outages with a 500 "Internal error encountered" on every
# metric set at once, which clears without any change on the customer's side. Left unmapped,
# the job keeps the raw status and a URL that names the customer's app.
+ # It also answers an outage with a bare 503 "Service Unavailable" on the same endpoints, with
+ # no response body to match on, so it needs its own entry alongside the 500 case. Without it,
+ # the activity's classifier (import_data_sync.py) treats the 503 as an unclassified failure
+ # and reports it to error tracking on every attempt instead of retrying quietly.
return {
"500 Server Error": (
"Google Play's reporting API had an internal error, so this sync couldn't finish. "
"This is on Google's side, and the next sync runs on schedule."
),
+ "503 Server Error": (
+ "Google Play's reporting API was unavailable, so this sync couldn't finish. "
+ "This is on Google's side, and the next sync runs on schedule."
+ ),
}
@property
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/tests/test_google_play_console.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/tests/test_google_play_console.py
index 8aa0e862eb82..466915220e54 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/tests/test_google_play_console.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_play_console/tests/test_google_play_console.py
@@ -475,13 +475,14 @@ def test_metric_set_reraises_a_403_that_is_not_the_games_restriction() -> None:
assert isinstance(result.raised, requests.HTTPError)
-def test_metric_set_server_error_stays_retryable_with_vendor_outage_copy() -> None:
[email protected]("status", [500, 503])
+def test_metric_set_server_error_stays_retryable_with_vendor_outage_copy(status: int) -> None:
with mock.patch(f"{MODULE}._today", return_value=TODAY):
result = _run(
"crash_rate",
[
ScriptedResponse(json=_freshness(dt.date(2024, 3, 2))),
- ScriptedResponse(status=500, body=b'{"error": {"status": "INTERNAL"}}'),
+ ScriptedResponse(status=status, body=b'{"error": {"status": "INTERNAL"}}'),
],
should_use_incremental_field=True,
db_incremental_field_last_value=dt.date(2024, 3, 1),