: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(warehouse-sources): keep Etsy's exhausted rate limits out of error tracking (#100703)
Tom Owersab0f789bb773
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/source.pyindex 8b881c734ee6..a41b045484e9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/source.py@@ -116,6 +116,15 @@ Register a personal app in the [Etsy developer portal](https://www.etsy.com/deve"This Etsy account has no shop": "The connected Etsy account does not own a shop. Enter the shop ID you want to sync, or reconnect with the seller account.",}+ def get_retryable_errors(self) -> set[str]:+ # EtsyClient reads over the tracked session, whose `DEFAULT_RETRY` adapter already retries+ # a 429 or 5xx three times. A response that still reaches us here is an exhausted upstream+ # blip — transient, not a PostHog bug — and Temporal retries the whole activity, so the+ # sync self-recovers. `raise_for_status` derives these prefixes from the status code alone,+ # not the vendor's reason text, so they're stable to match on (see mailchimp/impact sources+ # for the same pattern).+ return {"429 Client Error", "Server Error"}+def get_schemas(self,config: EtsySourceConfig,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy_source.pyindex 74b7a8d00805..20acf2ef53a2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy_source.py@@ -1,3 +1,5 @@+from parameterized import parameterized+from posthog.schema import DataWarehouseSourceCategory, ReleaseStatus, SourceFieldInputConfigfrom products.warehouse_sources.backend.temporal.data_imports.sources.etsy.settings import ENDPOINTS, ETSY_ENDPOINTS@@ -44,3 +46,17 @@ class TestEtsySourceClass:# get_schemas is a static catalog with no I/O, so the public docs table list must render.assert EtsySource.lists_tables_without_credentials is Trueassert {table["name"] for table in EtsySource().get_documented_tables()} == set(ENDPOINTS)++ @parameterized.expand(+ [+ ("429 Client Error: Too Many Requests for url: https://api.etsy.com/v3/application/users/me",),+ ("500 Server Error: Internal Server Error for url: https://api.etsy.com/v3/application/users/me",),+ ]+ )+ def test_rate_limit_and_server_errors_are_retryable(self, message: str) -> None:+ # EtsyClient's tracked session already retries a 429/5xx three times before raise_for_status+ # can raise; an exhausted rate limit or server error reaching us here must stay out of error+ # tracking as noise instead of being reported like a genuine PostHog bug.+ retryable_errors = EtsySource().get_retryable_errors()++ assert any(pattern in message for pattern in retryable_errors)