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(google-search-console): explain an exhausted query quota instead of the raw error (#123027)

Tom Owersec45a0aa786e
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py
index 7af72d1153e6..f980fa287b8c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py
@@ -137,6 +137,20 @@ class GoogleSearchConsoleSource(
# stable `(retryable)` marker, which does not collide with the 401/403 non-retryable keys.
return {"(retryable)"}
+ def get_retry_exhausted_errors(self) -> dict[str, str]:
+ # The quota raise sites name the customer's site and our own retry bookkeeping. The quota
+ # is shared by every table synced from the site, so a run that keeps exhausting it needs
+ # fewer or less frequent tables rather than a wait.
+ quota_message = (
+ "Google Search Console's query limit for your site ran out before this sync finished. "
+ "Sync fewer tables or sync them less often to stay within the limit."
+ )
+ return {
+ "Search Analytics daily quota for": quota_message,
+ "Search Analytics quota for": quota_message,
+ "Search Console quota exhausted while listing": quota_message,
+ }
+
def get_oauth_accounts(
self, integration_id: int, team_id: int, search: str | None = None
) -> list[IntegrationAccount]:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py
index f9be5335a70d..a29e25c20761 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py
@@ -60,11 +60,20 @@ def test_canonical_descriptions_cover_every_schema(config):
"Search Analytics daily quota for 'sc-domain:example.com' exhausted; retrying at the activity level (retryable)",
"Search Analytics quota for 'sc-domain:example.com' still exhausted after 3 retries (retryable)",
"Search Analytics quota for 'sc-domain:example.com' exhausted (retryable)",
+ "Search Console quota exhausted while listing sitemaps; the next sync picks it up (retryable)",
],
)
def test_exhausted_quota_is_retryable(error_message):
- retryable_errors = GoogleSearchConsoleSource().get_retryable_errors()
- assert error_message_matches(error_message, retryable_errors)
+ source = GoogleSearchConsoleSource()
+ assert error_message_matches(error_message, source.get_retryable_errors())
+ assert not error_message_matches(error_message, source.get_non_retryable_errors().keys())
+ messages = [
+ message
+ for pattern, message in source.get_retry_exhausted_errors().items()
+ if error_message_matches(error_message, [pattern])
+ ]
+ assert messages and "sync them less often" in messages[0]
+ assert "example.com" not in messages[0]
@pytest.mark.parametrize(