: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(vitally): stop reporting transient proxy blips during discovery (#126235)
Tom Owers77eb95ccf978
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.pyindex 051362e29195..693f0b4c1be8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py@@ -16,6 +16,9 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.basfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.errors import (+ is_transient_egress_proxy_error,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.registry import SourceRegistryfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import SourceSchemafrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceInputs, SourceResponse@@ -91,9 +94,14 @@ class VitallySource(SimpleSource[VitallySourceConfig]):except Exception as e:# A 401/403 here is a customer credential problem (invalid/revoked token), not a bug# we can fix — the per-schema sync path already surfaces it and disables the source.- # Skip capturing those to avoid spamming error tracking on every discovery run, but- # still capture genuinely unexpected discovery failures.- if not any(pattern in str(e) for pattern in self.get_non_retryable_errors()):+ # A transient egress-proxy blip is our own infrastructure being briefly unreachable,+ # not a sign of a bug either. Skip capturing both to avoid spamming error tracking on+ # every discovery run, but still capture genuinely unexpected discovery failures.+ message = str(e)+ is_known_benign = is_transient_egress_proxy_error(message) or any(+ pattern in message for pattern in self.get_non_retryable_errors()+ )+ if not is_known_benign:capture_exception(e)definitions = []diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.pyindex 79ebb7341373..77ce0b155a29 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py@@ -255,3 +255,24 @@ class TestVitallySourceGetSchemas:assert not any(s.name.startswith(CUSTOM_OBJECT_SCHEMA_PREFIX) for s in schemas)# Unexpected discovery failures are still captured for triage.mock_capture.assert_called_once()++ @patch("products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.capture_exception")+ @patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.list_custom_object_definitions"+ )+ def test_transient_egress_proxy_failure_is_not_captured(self, mock_list, mock_capture):+ # Regression: PostHog's own egress proxy briefly 502ing on the tunnel used to reach+ # Vitally was reported as an exception on every discovery run, even though it's not a+ # bug and the next attempt recovers on its own.+ mock_list.side_effect = ConnectionError(+ "HTTPSConnectionPool(host='example.rest.vitally.io', port=443): Max retries exceeded "+ "with url: /resources/customObjects?limit=100 (Caused by ProxyError('Cannot connect "+ "to proxy.', OSError('Tunnel connection failed: 502 Bad gateway')))"+ )++ schemas = VitallySource().get_schemas(self._make_config(), team_id=1)++ names = {s.name for s in schemas}+ assert {"Accounts", "Conversations", "Custom_Objects", "Messages"} <= names+ assert not any(s.name.startswith(CUSTOM_OBJECT_SCHEMA_PREFIX) for s in schemas)+ mock_capture.assert_not_called()