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(data-imports): keep exhausted REST retries out of error tracking (#74640)

Tom Owersb7e0cc665576
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/rest_client.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/rest_client.py
index e5f92e28f622..a93bd7f3dbc3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/rest_client.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/rest_client.py
@@ -30,7 +30,14 @@ from .utils import resolve_request_url
logger = logging.getLogger(__name__)
-class RESTClientRetryableError(Exception):
+class RESTClientRetryableError(NonReportableError):
+ """A transient failure (429/5xx, connection reset/timeout, malformed/truncated body) that
+ tenacity reissues up to the client's attempt cap. Once that budget is exhausted it escapes to
+ the activity and Temporal's own activity retry takes over — the upstream blip is expected to
+ clear, not a PostHog defect. Subclasses NonReportableError, like ``RESTClientNonRetryableError``,
+ so the activity interceptor keeps it out of error tracking instead of minting an issue per blip.
+ """
+
def __init__(self, message: str, retry_after: Optional[float] = None) -> None:
super().__init__(message)
self.retry_after = retry_after
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_rest_client.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_rest_client.py
index 4b1126306711..b75c81e62014 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_rest_client.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_rest_client.py
@@ -353,10 +353,14 @@ class TestRESTClient:
mock_session.send.return_value = error
client = RESTClient(base_url="https://api.example.com")
- with pytest.raises(RESTClientRetryableError):
+ with pytest.raises(RESTClientRetryableError) as ctx:
list(client.paginate(path="/items", paginator=SinglePagePaginator()))
assert mock_session.send.call_count == 5
+ # An upstream blip surviving every tenacity attempt is expected to clear on Temporal's own
+ # activity retry, not a PostHog defect, so it must carry the non-reportable marker the
+ # activity interceptor uses to keep it out of error tracking.
+ assert isinstance(ctx.value, NonReportableError)
@pytest.mark.parametrize(
"content",