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): stop reporting App Store Connect network blips as noise (#80118)

Tom Owers44b67f58d452
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/source.py
index f5b39224feda..4bd23a2b1945 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/source.py
@@ -119,6 +119,13 @@ Sales and subscription reports also need your vendor number (App Store Connect
"403 Client Error: Forbidden for url: https://api.appstoreconnect.apple.com": "Your App Store Connect API key does not have access to this data. Give the key a role that can read it (Finance or Sales for reports), then reconnect.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `_get` has no retry loop of its own — it relies on the tracked session's urllib3 adapter
+ # to retry a connection failure or read timeout. Once that budget is exhausted, Temporal
+ # retries the whole activity, so this is transient and self-recovering. The host is fixed
+ # (never user input), so matching on it doesn't risk swallowing an unrelated failure.
+ return {"HTTPSConnectionPool(host='api.appstoreconnect.apple.com'"}
+
def get_schemas(
self,
config: AppStoreConnectSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/tests/test_app_store_connect_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/tests/test_app_store_connect_source.py
index 69257a907a5d..b4e7f9bc7a91 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/tests/test_app_store_connect_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/app_store_connect/tests/test_app_store_connect_source.py
@@ -201,3 +201,23 @@ class TestAppStoreConnectSource:
assert any("401" in key for key in errors)
assert any("403" in key for key in errors)
assert all(message for message in errors.values())
+
+ @parameterized.expand(
+ [
+ (
+ "connection_error",
+ "HTTPSConnectionPool(host='api.appstoreconnect.apple.com', port=443): Max retries exceeded "
+ 'with url: /v1/apps?limit=200 (Caused by ReadTimeoutError("HTTPSConnectionPool'
+ "(host='api.appstoreconnect.apple.com', port=443): Read timed out. (read timeout=60)\"))",
+ ),
+ (
+ "read_timeout",
+ "HTTPSConnectionPool(host='api.appstoreconnect.apple.com', port=443): Read timed out. (read timeout=60)",
+ ),
+ ]
+ )
+ def test_retryable_errors_match_transient_network_failures(self, _name: str, observed_error: str) -> None:
+ # `_get` has no retry loop of its own — it relies on the tracked session's urllib3 adapter.
+ # Once that's exhausted, this keeps the benign, self-recovering failure out of error tracking.
+ retryable_errors = AppStoreConnectSource().get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)