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(warehouse-sources): stop tracking Gladly rate limits as failures (#98469)

Tom Owersb6df339cc93c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
index 1d96480b4991..b803cd484a34 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/source.py
@@ -87,7 +87,12 @@ class GladlySource(ResumableSource[GladlySourceConfig, GladlyResumeConfig]):
# regenerates the report and re-streams it; the resumable window state means only the
# in-flight window is redone, deduped on merge, so this is self-recovering rather than a
# tracked-exception-worthy failure.
- return {"Read timed out", "Gladly returned no report"}
+ #
+ # `GladlyRetryableError` (429/5xx from Gladly, raised by both `fetch` and `generate_report`)
+ # is itself retried with backoff inside gladly.py before it can ever reach here; if that
+ # budget still exhausts, Temporal's activity retry re-issues the same request or report
+ # window, so the same self-recovering reasoning applies.
+ return {"Read timed out", "Gladly returned no report", "Gladly API error (retryable)"}
def get_retry_exhausted_errors(self) -> dict[str, str]:
return {
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
index 29687ae63586..667d59967d23 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gladly/tests/test_gladly_source.py
@@ -52,6 +52,19 @@ class TestGladlySource:
error = "HTTPSConnectionPool(host='myorg.us-1.gladly.com', port=443): Read timed out."
assert any(key in error for key in retryable_errors)
+ @pytest.mark.parametrize(
+ "observed_error",
+ [
+ "Gladly API error (retryable): status=429, metricSet=ConversationTimestampsReport",
+ "Gladly API error (retryable): status=503, url=https://myorg.gladly.com/api/v1/export/jobs",
+ ],
+ )
+ def test_retryable_errors_match_gladly_rate_limit_and_server_errors(self, observed_error):
+ # A 429/5xx that outlasts gladly.py's own in-process retry is still self-recovering via
+ # Temporal's activity retry, not a tracked-exception-worthy failure.
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)
+
def test_get_schemas(self):
schemas = self.source.get_schemas(self.config, self.team_id)