: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(snowflake): stop reporting a self-recovering backend blip as an error (#107166)
Tom Owersa9e47a1fec4c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.pyindex 4b3754eb3d63..b3fc273aa371 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py@@ -595,11 +595,18 @@ class SnowflakeImplementation(table_name=table_name,exc_info=e,)+ error_str = str(e)# The table/schema was dropped, renamed, or its grant revoked after discovery —# `SnowflakeSource.get_non_retryable_errors` already treats this exact phrase as# user/upstream and non-actionable. Reporting it here would just be noise, since the# pipeline already recovers via the None fallback above.- if "does not exist or not authorized" not in str(e):+ #+ # "HTTP 503: Service Unavailable" is Snowflake's backend briefly unavailable — the+ # connector already retried internally (it re-raises after exhausting its own+ # `RetryRequest` budget) before this `SHOW` failed, the same self-recovering signature+ # `SnowflakeSource.get_retryable_errors` excludes from error tracking elsewhere.+ # Reporting it here would be noise for the same reason.+ if "does not exist or not authorized" not in error_str and "HTTP 503: Service Unavailable" not in error_str:capture_exception(e)return Nonediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.pyindex f67c5ab29705..7a8b6b1e1e6e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/source.py@@ -405,6 +405,13 @@ class SnowflakeSource(SQLSource[SnowflakeSourceConfig], ResumableSource[Snowflak# cleanly, so this is a self-recovering network blip rather than a bug. The errno and OS-# specific wrapping vary, so we match the stable requests-library wrapper phrase."Connection broken: ConnectionResetError",+ # Snowflake connector error 290503 (ER_HTTP_GENERAL_ERROR + 503): Snowflake's own backend+ # briefly returned HTTP 503 while the connector was already retrying internally (it+ # re-raises only after exhausting its own `RetryRequest` budget). A fresh Temporal-level+ # retry opens a new connection and re-executes the query from scratch, which recovers+ # cleanly once the backend blip clears, so this is self-recovering rather than a bug.+ # The errno prefix is volatile, so we match the stable status text.+ "HTTP 503: Service Unavailable",}def reconcile_schema_metadata(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.pyindex f6f7bcf60588..c5251ba6653c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py@@ -646,6 +646,9 @@ class TestGetPrimaryKeysForTable:"Table 'DB.PUBLIC.T' does not exist or not authorized.",False,),+ # Snowflake's backend was briefly unavailable — a self-recovering blip already+ # classified as retryable elsewhere; not worth reporting as a bug.+ ("290503: 290503: HTTP 503: Service Unavailable", False),# Anything else is unexpected and should still be surfaced.("some other driver failure", True),],@@ -1187,6 +1190,14 @@ class TestSnowflakeSourceRetryableErrors:is_retryable = any(pattern in error_msg for pattern in retryable)assert is_retryable, f"Mid-stream connection-reset error should be classified retryable: {error_msg}"+ def test_service_unavailable_is_retryable(self, source):+ # The real shape from production: the connector re-raised after exhausting its own+ # internal `RetryRequest` budget against a briefly-unavailable Snowflake backend.+ error_msg = "290503: 290503: HTTP 503: Service Unavailable"+ retryable = source.get_retryable_errors()+ is_retryable = any(pattern in error_msg for pattern in retryable)+ assert is_retryable, f"Backend service-unavailable error should be classified retryable: {error_msg}"+class TestSnowflakeValidateCredentials:@pytest.fixture