: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-imports): stop tracking self-recovering proxy tunnel errors in salesforce (#73131)
Tom Owersbd388ea2d98b
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/source.pyindex ef77c4beecae..6c6bb715f096 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/source.py@@ -75,6 +75,19 @@ class SalesforceSource(ResumableSource[SalesforceSourceConfig, SalesforceResumeC"expired access/refresh token": "Your Salesforce connection has expired or been revoked. Please reconnect the source.",}+ def get_retryable_errors(self) -> set[str]:+ # `salesforce_refresh_access_token` builds its own tracked session rather than going+ # through the shared REST client, so a proxy CONNECT failure during token refresh isn't+ # retried in-process beyond `DEFAULT_RETRY`'s few attempts before it re-raises here. Once+ # Temporal retries the whole activity the failure is transient and self-recovering (same+ # class of egress-proxy blip already classified this way for ClickHouse), so don't+ # surface it as tracked exception noise.+ return {+ "Tunnel connection failed: 502",+ "Tunnel connection failed: 503",+ "Tunnel connection failed: 504",+ }+def get_schemas(self,config: SalesforceSourceConfig,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/test/test_salesforce_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/test/test_salesforce_source.pyindex 6d06ba91311f..1d8eb39f0c1b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/test/test_salesforce_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/salesforce/test/test_salesforce_source.py@@ -32,6 +32,28 @@ class TestSalesforceSourceNonRetryableErrors:f"'{error_message}' must not match a non-retryable pattern")+ @pytest.mark.parametrize(+ "error_message",+ [+ "Tunnel connection failed: 502 Bad gateway",+ "Tunnel connection failed: 503 Service Unavailable",+ "Tunnel connection failed: 504 Gateway Timeout",+ "HTTPSConnectionPool(host='example.my.salesforce.com', port=443): Max retries exceeded "+ "with url: /services/oauth2/token (Caused by ProxyError('Cannot connect to proxy.', "+ "OSError('Tunnel connection failed: 502 Bad gateway')))",+ ],+ )+ def test_token_refresh_proxy_tunnel_failure_is_retryable(self, error_message):+ # salesforce_refresh_access_token builds its own tracked session, so a proxy CONNECT+ # failure during token refresh surfaces here as a bare OSError/ProxyError once+ # DEFAULT_RETRY's in-process attempts are exhausted. It's an egress-proxy blip Temporal's+ # activity retry recovers from, so it must stay out of error tracking as noise.+ retryable_errors = self.source.get_retryable_errors()++ assert any(pattern in error_message for pattern in retryable_errors), (+ f"Expected '{error_message}' to match a retryable pattern"+ )+class TestSalesforceSourceVersions:def setup_method(self):