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(matomo): keep exhausted-retry 429/5xx errors out of error tracking (#72454)

Tom Owersf4e4e4387ec2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
index d15a0931804a..15e9b18e4938 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
@@ -61,6 +61,12 @@ class MatomoSource(ResumableSource[MatomoSourceConfig, MatomoResumeConfig], Vali
"Matomo API error:": None,
}
+ def get_retryable_errors(self) -> set[str]:
+ # A 429 or 5xx is retried internally; if those retries still exhaust, the failure is
+ # transient and self-recovering, so let Temporal retry the activity without surfacing
+ # it as tracked exception noise.
+ return {"Matomo API error (retryable)"}
+
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
index d4f67038b012..55948d72d659 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
@@ -63,6 +63,19 @@ class TestMatomoSource:
error = "500 Server Error for url: https://myorg.matomo.cloud/index.php"
assert not any(key in error for key in non_retryable_errors)
+ @pytest.mark.parametrize(
+ "observed_error",
+ [
+ "Matomo API error (retryable): status=500",
+ "Matomo API error (retryable): status=429",
+ ],
+ )
+ def test_retryable_errors_match_known_failures(self, observed_error):
+ # Matches the message `call()` raises in matomo.py after its internal retry loop
+ # exhausts; keeps this benign, self-recovering failure out of error tracking.
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)
+
def test_get_schemas(self):
schemas = {schema.name: schema for schema in self.source.get_schemas(self.config, self.team_id)}