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_analytics): stop paging error tracking on read timeouts (#88771)

Tom Owers4336d68fd83c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/source.py
index 96b7061f3b14..4488c3ced51f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/source.py
@@ -80,11 +80,12 @@ class GoogleAnalyticsSource(ResumableSource[GoogleAnalyticsSourceConfig, GoogleA
# time and the resumable source picks up from the last saved chunk, so let Temporal
# retry the activity without paging it as a bug.
#
- # "Connection aborted"/"Connection reset by peer" are transport-level blips from `requests`
- # raised directly by `session.post()` in `_run_report`, outside its own retry loop (which only
- # handles `RefreshError` and HTTP-level failures). The resumable source picks up from the last
- # saved chunk on the next Temporal retry, same as ClickHouse's source classifies this text.
- return {"(retryable)", "Connection aborted", "Connection reset by peer"}
+ # "Connection aborted"/"Connection reset by peer"/"Read timed out" are transport-level blips
+ # from `requests` raised directly by `session.post()` in `_run_report`, outside its own retry
+ # loop (which only handles `RefreshError` and HTTP-level failures). The resumable source picks
+ # up from the last saved chunk on the next Temporal retry, same as ClickHouse's source
+ # classifies this text.
+ return {"(retryable)", "Connection aborted", "Connection reset by peer", "Read timed out"}
def get_schemas(
self,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/tests/test_google_analytics_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/tests/test_google_analytics_source.py
index 2872208d0af3..5b62741cbf99 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/tests/test_google_analytics_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_analytics/tests/test_google_analytics_source.py
@@ -283,3 +283,12 @@ def test_retryable_errors_cover_connection_reset():
error_msg = "('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))"
patterns = GoogleAnalyticsSource().get_retryable_errors()
assert error_message_matches(error_msg, patterns)
+
+
+def test_retryable_errors_cover_read_timeout():
+ # A read timeout talking to the Data API surfaces as a `requests.ConnectionError` from
+ # `session.post()` in `_run_report`, same as the connection-reset case above — must stay
+ # classified as retryable so it doesn't page as a bug.
+ error_msg = "HTTPSConnectionPool(host='analyticsdata.googleapis.com', port=443): Read timed out."
+ patterns = GoogleAnalyticsSource().get_retryable_errors()
+ assert error_message_matches(error_msg, patterns)