: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 reporting transient DebugBear errors as exceptions (#125768)
Tom Owersfd73ce024040
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/source.pyindex cdbc0f72ed7f..2b92f4dbffbf 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/source.py@@ -52,6 +52,17 @@ class DebugbearSource(SimpleSource[DebugbearSourceConfig]):"DebugBear rejected the RUM metrics request": None,}+ def get_retryable_errors(self) -> set[str]:+ # `_session`'s `make_tracked_session()` already retries 429/5xx, including the Cloudflare+ # 52x/530 family DebugBear can surface on an edge/origin blip, at the urllib3 layer before+ # `_get_json`'s `raise_for_status()` can even raise (see `DEFAULT_RETRY` in+ # sources/common/http/transport.py). A response that still exhausts that budget is a+ # transient DebugBear/edge issue, not a bug, so Temporal's activity retry recovers once it+ # clears rather than surfacing it as tracked exception noise. `raise_for_status` derives+ # these prefixes from the status code alone, not the vendor's reason text, so they're+ # stable to match on.+ return {"Server Error", "429 Client Error"}+def get_canonical_descriptions(self) -> CanonicalDescriptions:from products.warehouse_sources.backend.temporal.data_imports.sources.debugbear.canonical_descriptions import (CANONICAL_DESCRIPTIONS,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/tests/test_debugbear_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/tests/test_debugbear_source.pyindex bf776f65a146..0db06b142a17 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/tests/test_debugbear_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/debugbear/tests/test_debugbear_source.py@@ -35,3 +35,29 @@ class TestDebugbearSource:errors = self.source.get_non_retryable_errors()assert pattern in errorsassert any(p in message for p in errors)++ @pytest.mark.parametrize(+ "message",+ [+ # DebugBear sits behind Cloudflare; a persistent edge/origin blip surfaces as a raw+ # 52x after the transport's own retries are exhausted.+ "530 Server Error: <none> for url: https://www.debugbear.com/api/v1/projects",+ "502 Server Error: Bad Gateway for url: https://www.debugbear.com/api/v1/projects",+ "503 Server Error: Service Unavailable for url: https://www.debugbear.com/api/v1/projects",+ "429 Client Error: Too Many Requests for url: https://www.debugbear.com/api/v1/projects",+ ],+ )+ def test_retryable_errors_match(self, message: str) -> None:+ errors = self.source.get_retryable_errors()+ assert any(p in message for p in errors)++ @pytest.mark.parametrize(+ "message",+ [+ "401 Client Error: Unauthorized for url: https://www.debugbear.com/api/v1/projects",+ "403 Client Error: Forbidden for url: https://www.debugbear.com/api/v1/projects",+ ],+ )+ def test_retryable_errors_do_not_match_client_errors(self, message: str) -> None:+ errors = self.source.get_retryable_errors()+ assert not any(p in message for p in errors)