Skip to content

: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.

fix(warehouse-sources): stop reporting exhausted-retry BuildBetter 5xx/429 as tracked errors (#85082)

Tom Owers52b04de3ce14
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/source.py
index 7c64a5bb4f37..175bf5066293 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/source.py
@@ -61,6 +61,13 @@ class BuildBetterSource(ResumableSource[BuildBetterSourceConfig, BuildBetterResu
"webhook authentication request failed": "BuildBetter authentication failed. Please check your API key.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `execute`'s own tenacity retry already retries a 5xx or 429 (raised as
+ # BuildBetterRetryableError) up to 5 attempts; once that budget exhausts, Temporal retries
+ # the whole activity from the saved pagination checkpoint, so the failure is transient and
+ # self-recovering rather than tracked-exception-worthy.
+ return {"BuildBetter: server error", "BuildBetter: rate limited"}
+
def get_schemas(
self,
config: BuildBetterSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/test_buildbetter.py b/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/test_buildbetter.py
index 54b718f940ce..dd015bb3b55d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/test_buildbetter.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/buildbetter/test_buildbetter.py
@@ -268,3 +268,19 @@ class TestBuildBetterSourceNonRetryableErrors:
def test_does_not_match_transient_errors(self, _name: str, other_error: str) -> None:
non_retryable_errors = self.source.get_non_retryable_errors()
assert not any(key in other_error for key in non_retryable_errors)
+
+
+class TestBuildBetterSourceRetryableErrors:
+ def setup_method(self) -> None:
+ self.source = BuildBetterSource()
+
+ @parameterized.expand(
+ [
+ ("server_error_502", "BuildBetter: server error 502"),
+ ("server_error_503", "BuildBetter: server error 503"),
+ ("rate_limited", "BuildBetter: rate limited"),
+ ]
+ )
+ def test_matches_exhausted_internal_retries(self, _name: str, observed_error: str) -> None:
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(pattern in observed_error for pattern in retryable_errors)