: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(data-imports): stop retrying mux's rejected max_request_latency metric (#115550)
Tom Owers815fdd601dbe
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mux/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mux/source.pyindex 1f07f0e7d4ba..2d3147632b46 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mux/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mux/source.py@@ -106,6 +106,17 @@ Grant the following read permissions:"reaches further back than your Mux plan keeps. Check your Mux Data retention window, or ""contact PostHog support if this keeps happening."),+ # Some Mux Data accounts reject `max_request_latency` timeseries queries with a 400 and+ # the generic `code=bad_request` (no specific sub-code), regardless of the timeframe —+ # every request/credential/scope here is otherwise valid, so retrying replays the same+ # rejection. Matched on the path plus the query prefix (not just `code=bad_request`,+ # which Mux also returns for genuinely malformed requests on other endpoints) so a 5xx/+ # timeout for this same URL — whose message carries no query string — stays retryable.+ "metrics/max_request_latency/timeseries?timeframe": (+ "Mux rejected the request-latency metric sync for this account. This can happen when "+ "the account's Mux Data plan doesn't include request-latency metrics. Contact PostHog "+ "support if this keeps happening."+ ),}def get_schemas(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mux/tests/test_mux_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mux/tests/test_mux_source.pyindex 44125323e4a0..885f62d1a9b4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mux/tests/test_mux_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mux/tests/test_mux_source.py@@ -66,6 +66,10 @@ class TestMuxNonRetryableErrors:"invalid_timeframe","400 Client Error: Bad Request for url: https://api.mux.com/data/v1/errors | api error: code=invalid_timeframe",),+ (+ "max_request_latency_bad_request",+ "400 Client Error: Bad Request for url: https://api.mux.com/data/v1/metrics/max_request_latency/timeseries?timeframe%5B%5D=1784040390&timeframe%5B%5D=1791816390&group_by=day | api error: code=bad_request",+ ),])def test_deterministic_client_errors_are_non_retryable(self, _name: str, observed_error: str) -> None:@@ -76,6 +80,12 @@ class TestMuxNonRetryableErrors:[("server_error", "500 Server Error: Internal Server Error for url: https://api.mux.com/video/v1/assets"),("read_timeout", "HTTPSConnectionPool(host='api.mux.com', port=443): Read timed out."),+ # A transient 5xx/timeout for this same metric+endpoint carries no query string (see+ # `_safe_url` in rest_client), so it must not collide with the bad_request entry above.+ (+ "max_request_latency_server_error",+ "HTTP 500 for https://api.mux.com/data/v1/metrics/max_request_latency/timeseries",+ ),])def test_transient_errors_remain_retryable(self, _name: str, other_error: str) -> None: