: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_pagespeed_insights): keep transport timeouts out of tracked error noise (#75072)
Tom Owers9bae4f9a4a5b
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/source.pyindex bdad0f0077a6..a4fbccefac52 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/source.py@@ -111,7 +111,15 @@ Each analysis is a full Lighthouse run and can take several seconds. Each URL is# tenacity-wrapped `_fetch`); if those retries still exhaust, the failure is transient and# self-recovering, so let Temporal retry the activity without surfacing it as tracked# exception noise.- return {"PageSpeed Insights API error (retryable)"}+ return {+ "PageSpeed Insights API error (retryable)",+ # Transport-level failures (read timeouts, connection resets/SSL) are retried the same way+ # by `_fetch`; once exhausted they re-raise as a urllib3 `HTTPSConnectionPool(...)` message.+ # Same self-recovering class as the 429/5xx path — keep them retryable and out of tracked+ # noise. Scoped to the fixed API host so it can only match a transient connection failure to+ # PageSpeed, never the `... Client Error ... for url` shape the auth 400/403s carry.+ "HTTPSConnectionPool(host='pagespeedonline.googleapis.com'",+ }def get_schemas(self,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/tests/test_google_pagespeed_insights_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/tests/test_google_pagespeed_insights_source.pyindex cc1ee5e47ff9..39c10c219280 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/tests/test_google_pagespeed_insights_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_pagespeed_insights/tests/test_google_pagespeed_insights_source.py@@ -114,6 +114,21 @@ class TestGooglePageSpeedInsightsSource:retryable_errors = self.source.get_retryable_errors()assert any(pattern in error_message for pattern in retryable_errors)+ def test_transport_timeout_is_retryable_not_terminal(self):+ # A read timeout / connection reset to the API host exhausts `_fetch`'s internal retries and+ # re-raises as a urllib3 `HTTPSConnectionPool(...)` message (key already redacted). It is+ # transient and self-recovering, so it must classify as retryable and never match the+ # auth-failure patterns that would permanently stop the sync.+ error_message = (+ "HTTPSConnectionPool(host='pagespeedonline.googleapis.com', port=443): Max retries exceeded "+ "with url: /pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fexample.com&strategy=DESKTOP&key=REDACTED "+ "(Caused by ReadTimeoutError(\"HTTPSConnectionPool(host='pagespeedonline.googleapis.com', port=443): "+ 'Read timed out. (read timeout=120)"))'+ )++ assert any(pattern in error_message for pattern in self.source.get_retryable_errors())+ assert not any(pattern in error_message for pattern in self.source.get_non_retryable_errors())+def test_documented_tables_render_without_credentials(self):# Exercises the public-docs path: a credential-free placeholder config must list every table.tables = self.source.get_documented_tables()