: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(warehouse-sources): stop AWS Cost Explorer server errors from paging error tracking (#105649)
Tom Owers1521d56a34cb
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/source.pyindex c5ab3adf4b7e..6eaddd7fb4da 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/source.py@@ -8,6 +8,7 @@ from products.warehouse_sources.backend.facade.source_config import (SourceFieldInputConfigType,)from products.warehouse_sources.backend.temporal.data_imports.sources.aws_cost_explorer.aws_cost_explorer import (+ THROTTLING_ERROR_CODES,VALIDATION_ERROR_MESSAGES,AwsCostExplorerResumeConfig,aws_cost_explorer_source,@@ -53,6 +54,18 @@ class AwsCostExplorerSource(ResumableSource[AwsCostExplorerSourceConfig, AwsCost)return errors+ def get_retryable_errors(self) -> set[str]:+ # `send_operation` already exhausts a transport-level retry (429/5xx) and, for the+ # app-level throttling codes, a tenacity retry loop before any of these reach here. AWS's+ # own server-side hiccups (a generic InternalFailure, or a 5xx with no recognizable AWS+ # error type) recover the same way. Temporal retries the whole activity next, so log these+ # at warning instead of raising an error tracking issue for a transient AWS outage.+ return {f"AWS Cost Explorer request failed: {code}" for code in THROTTLING_ERROR_CODES} | {+ "AWS Cost Explorer request failed: InternalFailure",+ "AWS Cost Explorer request failed: ServiceUnavailable",+ "AWS Cost Explorer request failed: HTTP 5",+ }+def get_canonical_descriptions(self) -> CanonicalDescriptions:from products.warehouse_sources.backend.temporal.data_imports.sources.aws_cost_explorer.canonical_descriptions import (CANONICAL_DESCRIPTIONS,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/tests/test_aws_cost_explorer_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/tests/test_aws_cost_explorer_source.pyindex d1c21632ca0b..c44db56400aa 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/tests/test_aws_cost_explorer_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/aws_cost_explorer/tests/test_aws_cost_explorer_source.py@@ -72,10 +72,13 @@ class TestAwsCostExplorerSource:["AWS Cost Explorer request failed: LimitExceededException - Rate exceeded","AWS Cost Explorer request failed: HTTP 503 - ",+ "AWS Cost Explorer request failed: InternalFailure - ",+ "AWS Cost Explorer request failed: ServiceUnavailableException - ",],)def test_transient_aws_failures_keep_retrying(self, observed_error: str) -> None:assert not any(key in observed_error for key in self.source.get_non_retryable_errors())+ assert any(key in observed_error for key in self.source.get_retryable_errors())@pytest.mark.parametrize("endpoint", list(ENDPOINTS))def test_source_for_pipeline_uses_the_endpoints_primary_key_and_a_stable_partition_key(self, endpoint: str) -> None: