: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(matomo): name the failure when a temporary API error outlives retries (#103326)
Tom Owersde70ec643cf3
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.pyindex ce56a1720855..548bb8036256 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@@ -66,6 +66,16 @@ class MatomoSource(ResumableSource[MatomoSourceConfig, MatomoResumeConfig], Vali# it as tracked exception noise.return {"Matomo API error (retryable)"}+ def get_retry_exhausted_errors(self) -> dict[str, str]:+ # Once Temporal's retries are spent too, the job keeps the internal marker above as its+ # customer-facing error, down to the raw HTTP status. Name the failure instead.+ return {+ "Matomo API error (retryable)": (+ "Matomo kept returning temporary errors, such as rate limits, so this sync run did "+ "not finish. This usually clears on its own and the next sync runs on schedule."+ ),+ }+@propertydef 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.pyindex dbdf604693a3..5b721f1959a9 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@@ -52,6 +52,14 @@ class TestMatomoSource:retryable_errors = self.source.get_retryable_errors()assert any(key in observed_error for key in retryable_errors)+ def test_retry_exhausted_message_replaces_the_internal_marker(self):+ # Without this the job stores the raw marker, HTTP status and all, as what the customer reads.+ error = "Matomo API error (retryable): status=502"+ messages = [message for key, message in self.source.get_retry_exhausted_errors().items() if key in error]+ assert messages, "An exhausted Matomo retry should store a customer-facing message"+ assert "502" not in messages[0]+ assert "next sync runs on schedule" in messages[0]+def test_get_schemas(self):schemas = {schema.name: schema for schema in self.source.get_schemas(self.config, self.team_id)}