: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 tracking benign billing-limit halts (#73137)
Tom Owers749b49096a1e
diff --git a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.pyindex 1cd43f22e255..80390c470490 100644--- a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py+++ b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py@@ -507,7 +507,7 @@ class ExternalDataJobWorkflow(PostHogWorkflow):"start_to_close_timeout": dt.timedelta(weeks=1),"retry_policy": RetryPolicy(maximum_attempts=max_resumable_attempts,- non_retryable_error_types=["NonRetryableException"],+ non_retryable_error_types=["NonRetryableException", "BillingLimitsWillBeReachedException"],),}elif incremental_or_append:@@ -515,14 +515,15 @@ class ExternalDataJobWorkflow(PostHogWorkflow):"start_to_close_timeout": dt.timedelta(weeks=1),"retry_policy": RetryPolicy(maximum_attempts=max_incremental_attempts,- non_retryable_error_types=["NonRetryableException"],+ non_retryable_error_types=["NonRetryableException", "BillingLimitsWillBeReachedException"],),}else:timeout_params = {"start_to_close_timeout": dt.timedelta(hours=24),"retry_policy": RetryPolicy(- maximum_attempts=3, non_retryable_error_types=["NonRetryableException"]+ maximum_attempts=3,+ non_retryable_error_types=["NonRetryableException", "BillingLimitsWillBeReachedException"],),}diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/test/test_pipeline_utils.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/test/test_pipeline_utils.pyindex 255f06c02f39..b7d6e0df64b0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/test/test_pipeline_utils.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/test/test_pipeline_utils.py@@ -15,9 +15,12 @@ import structlogfrom dateutil import parserfrom structlog.types import FilteringBoundLogger+from posthog.temporal.common.errors import NonReportableError+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.consts import PARTITION_KEYfrom products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.utils import (NULL_NUMERICAL_PARTITION,+ BillingLimitsWillBeReachedException,SchemaColumnTypeChangedException,_get_max_decimal_type,_to_list_array,@@ -1457,3 +1460,9 @@ def test_append_partition_key_missing_column_buckets_into_fallback(partitioned_table, resolved_mode, _, _ = resultassert resolved_mode == modeassert partitioned_table.column(PARTITION_KEY).to_pylist() == [expected, expected, expected]+++def test_billing_limit_exception_is_non_reportable_error():+ # Subclassing NonReportableError is what keeps the intentional billing-limit halt out of+ # error tracking (the activity interceptor re-raises these without capturing them).+ assert issubclass(BillingLimitsWillBeReachedException, NonReportableError)diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/utils.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/utils.pyindex 6b1807063a33..7c95fbcd7cef 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/utils.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline/utils.py@@ -23,6 +23,7 @@ from dlt.common.libs.deltalake import ensure_delta_compatible_arrow_schemafrom structlog.types import FilteringBoundLoggerfrom posthog.sync import database_sync_to_async_pool+from posthog.temporal.common.errors import NonReportableErrorfrom products.warehouse_sources.backend.temporal.data_imports.naming_convention import NamingConventionfrom products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.consts import PARTITION_KEY@@ -63,8 +64,10 @@ type SupportedDltDataType = Literal["text", "bigint", "bool", "timestamp", "jsontype DecimalInput = decimal.Decimal | float | str | tuple[int, Sequence[int], int]-class BillingLimitsWillBeReachedException(Exception):- pass+class BillingLimitsWillBeReachedException(NonReportableError):+ """The sync was intentionally halted because the account will cross its Data Warehouse billing+ limit. Expected control flow, not a defect: the workflow marks the job BILLING_LIMIT_TOO_LOW,+ and subclassing NonReportableError keeps it out of error tracking."""class DuplicatePrimaryKeysException(Exception):