: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(instagram): keep already-retried meta blips out of error tracking (#103594)
Tom Owers5e8e66a39e2d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.pyindex 4af56c3fd624..b7f9e42dca5e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py@@ -137,6 +137,14 @@ Connect your Instagram account, then pick the professional account you want to s),}+ def get_retryable_errors(self) -> set[str]:+ # `instagram.py`'s `InstagramClient.get` already retries these in-process via tenacity+ # (5 attempts, exponential backoff) before re-raising `InstagramRetryableError`. A+ # 429/5xx/throttle/transient code that survives all 5 attempts is a momentary Meta Graph+ # API blip, not a bug — Temporal's activity retry recovers once it clears, so keep it out+ # of error tracking as noise.+ return {"Instagram API error (retryable)"}+def get_canonical_descriptions(self) -> CanonicalDescriptions:from products.warehouse_sources.backend.temporal.data_imports.sources.instagram.canonical_descriptions import ( # noqa: PLC0415CANONICAL_DESCRIPTIONS,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.pyindex dc9f83b54cc7..89d5cc595494 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py@@ -98,6 +98,18 @@ class TestInstagramSource:assert not any(key in observed_error for key in self.source.get_non_retryable_errors())+ @pytest.mark.parametrize(+ "observed_error",+ [+ "Instagram API error (retryable): status=429, code=4, message=rate limited",+ "Instagram API error (retryable): status=500, code=2, message=An unexpected error has occurred. "+ "Please retry your request later.",+ "Instagram API error (retryable): status=503, message=response body was not JSON",+ ],+ )+ def test_a_transient_meta_blip_is_kept_out_of_error_tracking_as_noise(self, observed_error: str) -> None:+ assert any(key in observed_error for key in self.source.get_retryable_errors())+def test_validate_credentials_uses_the_connection_token_and_the_chosen_account(self) -> None:with (mock.patch.object(InstagramSource, "_access_token", return_value="refreshed-token"),