: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(doit): classify concurrent report quota 429 as retryable (#108081)
Tom Owers7296c9c28543
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.pyindex 067f1ca0ffe8..cf89e0b14d41 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py@@ -76,6 +76,15 @@ class DoItSource(SimpleSource[DoItSourceConfig]):"invalid token: missing expiration": bad_key,}+ def get_retryable_errors(self) -> set[str]:+ # `DOIT_RETRY` already retries a 429 at the transport level; this is DoIt's own account-wide+ # concurrency quota (multiple schemas of one source can query reports at once), which can+ # outlast that budget. It clears once the other in-flight requests finish, and Temporal+ # retries the whole activity from there, so it's transient and self-recovering rather than a+ # bug. Match the trailing phrase only — the quota key embedded earlier in the message is+ # account-specific.+ return {"exhausted; please wait for previous requests to complete"}+def source_for_pipeline(self, config: DoItSourceConfig, inputs: SourceInputs) -> SourceResponse:report_id = resolve_report_id(config, inputs.schema_name, inputs.schema_metadata, logger=inputs.logger)return doit_source(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.pyindex 46325494c217..84b97f9af006 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py@@ -1,6 +1,7 @@import pytestfrom unittest.mock import MagicMock, patch+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matchesfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.http import DEFAULT_RETRYfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceInputsfrom products.warehouse_sources.backend.temporal.data_imports.sources.doit.doit import (@@ -41,6 +42,17 @@ class TestDoItSource:assert "reconnect" in (errors[pattern] or "")+ def test_retryable_errors_cover_the_concurrent_query_quota(self):+ error_msg = (+ 'Request to get report failed with status: 429. With body: {"error":"concurrent report query '+ 'requests quota for \\"some-account-id\\" exhausted; please wait for previous requests to complete."}'+ )++ # Self-recovering once the other in-flight report queries finish, so it must stay retryable+ # (and out of the non-retryable set) rather than disabling the schema.+ assert error_message_matches(error_msg, self.source.get_retryable_errors())+ assert not error_message_matches(error_msg, self.source.get_non_retryable_errors().keys())+def test_get_schemas_stamps_the_report_id_so_renames_stay_resolvable(self):with patch(f"{_SOURCE_MODULE}.doit_list_reports",