: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_sheets): don't report exhausted network retries as errors (#80387)
Tom Owers9b8aacb6b84e
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/source.pyindex af3b88bcc6e1..39fadf085853 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/source.py@@ -85,6 +85,13 @@ class GoogleSheetsSource(SimpleSource[GoogleSheetsSourceConfig]):"APIError: [502]","APIError: [503]","APIError: [504]",+ # `_retry_on_transient_api_error` also retries a dropped connection or read timeout+ # (`requests.exceptions.ConnectionError`/`Timeout`/`ChunkedEncodingError`) before+ # re-raising once that budget is exhausted. urllib3 wraps all of those as "... Max+ # retries exceeded with url: ..." regardless of the underlying cause (refused+ # connection, read timeout, dropped socket), so match that stable prefix rather than+ # the per-request URL or nested error detail.+ "Max retries exceeded with url",}def get_schemas(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/tests/test_google_sheets.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/tests/test_google_sheets.pyindex 216c0737541a..567fec143790 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/tests/test_google_sheets.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_sheets/tests/test_google_sheets.py@@ -506,6 +506,33 @@ def test_error_string_matches_a_retryable_key(status_code):assert any(key in str(error) for key in retryable_errors)+ "error_message",+ [+ pytest.param(+ "HTTPSConnectionPool(host='sheets.googleapis.com', port=443): Max retries exceeded with url: "+ '/v4/spreadsheets/abc123/values/Sheet1%211%3A1 (Caused by ReadTimeoutError("HTTPSConnectionPool'+ "(host='sheets.googleapis.com', port=443): Read timed out. (read timeout=120.0)\"))",+ id="read_timeout_after_retries_exhausted",+ ),+ pytest.param(+ "HTTPSConnectionPool(host='sheets.googleapis.com', port=443): Max retries exceeded with url: "+ "/v4/spreadsheets/abc123 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection "+ "object at 0x7f0000000000>: Failed to establish a new connection: [Errno 110] Connection timed out'))",+ id="connection_refused_after_retries_exhausted",+ ),+ ],+)+def test_error_string_matches_a_retryable_key_for_network_errors(error_message):+ """`_retry_on_transient_api_error` also retries `requests.exceptions.ConnectionError`/`Timeout`/+ `ChunkedEncodingError` in-process; once that budget is exhausted, urllib3 re-raises them wrapped+ as "Max retries exceeded with url". If that prefix drops out of `get_retryable_errors()`, a+ transient network blip starts polluting error tracking even though Temporal still retries it."""+ retryable_errors = GoogleSheetsSource().get_retryable_errors()++ assert any(key in error_message for key in retryable_errors)++@pytest.mark.parametrize("call_site",[