: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(google-play-console): explain a play reporting api outage instead of a raw 500 (#123026)
Tom Owersb597378c6068
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.pyindex 9d95ee44e8cb..e39388ae63a9 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@@ -101,6 +101,20 @@ class GooglePlayConsoleSource(ResumableSource[GooglePlayConsoleSourceConfig, Goo),}+ def get_retryable_errors(self) -> set[str]:+ return set(self.get_retry_exhausted_errors())++ def get_retry_exhausted_errors(self) -> dict[str, str]:+ # 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.+ 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."+ ),+ }+@propertydef get_source_config(self) -> SourceConfig:return SourceConfig(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.pyindex ae0d36727a29..8aa0e862eb82 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@@ -12,6 +12,7 @@ import structlogfrom cryptography.hazmat.primitives import serializationfrom cryptography.hazmat.primitives.asymmetric import rsa+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matchesfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.testing import (DriveResult,RecordedRequest,@@ -474,6 +475,30 @@ 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:+ 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"}}'),+ ],+ should_use_incremental_field=True,+ db_incremental_field_last_value=dt.date(2024, 3, 1),+ )++ source = GooglePlayConsoleSource()+ error = str(result.raised)+ assert not error_message_matches(error, source.get_non_retryable_errors().keys())+ assert error_message_matches(error, source.get_retryable_errors())+ messages = [+ message+ for pattern, message in source.get_retry_exhausted_errors().items()+ if error_message_matches(error, [pattern])+ ]+ assert messages and "on Google's side" in messages[0]++def test_metric_set_query_follows_pagination_until_the_token_runs_out() -> None:with mock.patch(f"{MODULE}._today", return_value=TODAY):result = _run(