: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(data-warehouse): explain exhausted retryable-status errors in plain words (#115030)
Tom Owers2dd45056962f
diff --git a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.pyindex 51d91113b918..d4f6f6e5f9a4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py+++ b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py@@ -396,6 +396,12 @@ TRANSIENT_SOURCE_ERROR_MESSAGE = ("again on its next schedule.")+# The marker hand-rolled source transports raise once their own backoff on a 429 or 5xx runs out:+# "<Vendor> API error (retryable): status=<code>, url=<url>". Unlike `RESTClientRetryableError`+# it reaches the finalizer as plain message text, which carries the vendor URL and, for a+# self-hosted source, the customer's own host.+RETRYABLE_STATUS_ERROR_MARKER = "(retryable): status="+def _customer_facing_error(cause: BaseException | None) -> str:"""`latest_error` text a customer reads, without the leaked internal exception class name.@@ -642,13 +648,23 @@ async def _update_job_status(inputs: UpdateExternalDataJobStatusInputs, logger:# consulted first; the source's own exhaustion messages cover the classes it does not# name. Retryability is untouched: the schema is not disabled and the next scheduled# run still tries.- transient_message = _transient_error_message(internal_error_normalized) or next(- (- message- for error, message in source_cls.get_retry_exhausted_errors().items()- if error_message_matches(internal_error_normalized, [error])- ),- None,+ # The retryable-status marker comes last, so a source that names its own vendor in+ # `get_retry_exhausted_errors` keeps that copy.+ transient_message = (+ _transient_error_message(internal_error_normalized)+ or next(+ (+ message+ for error, message in source_cls.get_retry_exhausted_errors().items()+ if error_message_matches(internal_error_normalized, [error])+ ),+ None,+ )+ or (+ TRANSIENT_SOURCE_ERROR_MESSAGE+ if error_message_matches(internal_error_normalized, [RETRYABLE_STATUS_ERROR_MARKER])+ else None+ ))if transient_message is not None:inputs.latest_error = transient_messagediff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/test_external_data_job_activities.py b/products/warehouse_sources/backend/temporal/data_imports/tests/test_external_data_job_activities.pyindex 8000bbf6c6ee..5135f6b419a8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/test_external_data_job_activities.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/test_external_data_job_activities.py@@ -33,6 +33,7 @@ from products.warehouse_sources.backend.temporal.data_imports.external_data_jobtrigger_schedule_buffer_one_activity,update_external_data_job_model,)+from products.warehouse_sources.backend.temporal.data_imports.sources.matomo.source import MatomoSourcefrom products.warehouse_sources.backend.temporal.data_imports.sources.postgres.source import (_CONNECTION_LIMIT_EXHAUSTED_MESSAGE,)@@ -428,6 +429,20 @@ def test_read_only_transaction_disables_the_schema_only_when_the_source_raised_i"503 Server Error: Service Temporarily Unavailable for url: https://api.up.railway.app/v1/things",TRANSIENT_VENDOR_UNAVAILABLE_MESSAGE,),+ # A hand-rolled transport's own retryable marker, which no map names for this source.+ (+ "retryable_status_marker",+ ExternalDataSourceType.HUBSPOT,+ "Hubspot search error (retryable): status=500, url=https://api.example.com/v3/things/search",+ TRANSIENT_SOURCE_ERROR_MESSAGE,+ ),+ # A source that names its vendor for the same marker keeps that copy over the generic one.+ (+ "retryable_status_marker_with_source_copy",+ ExternalDataSourceType.MATOMO,+ "Matomo API error (retryable): status=503, url=https://matomo.example.com/index.php",+ MatomoSource().get_retry_exhausted_errors()["Matomo API error (retryable)"],+ ),])@pytest.mark.django_db(transaction=True)