: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(datadog): send start_month on the estimated cost sync (#128767)
Tom Owersf8e1fb140757
diff --git a/products/warehouse_sources/sources/datadog/settings.py b/products/warehouse_sources/sources/datadog/settings.pyindex eff542508d54..f321e491fb99 100644--- a/products/warehouse_sources/sources/datadog/settings.py+++ b/products/warehouse_sources/sources/datadog/settings.py@@ -387,8 +387,11 @@ DATADOG_ENDPOINTS: dict[str, DatadogEndpointConfig] = {pagination="none",flatten_attributes=True,partition_key="date",- # Datadog only holds estimated cost for the current and previous month, so there is no- # history to filter into and the whole window is cheap to re-read each sync.+ # The endpoint 400s with no params unless either start_month or start_date is sent, and+ # rejects a start_month beyond two months back, so this must stay well under that.+ timestamp_filter_param="start_month",+ timestamp_filter_format="month",+ default_lookback_days=30,),"slo_corrections": DatadogEndpointConfig(name="slo_corrections",diff --git a/products/warehouse_sources/sources/datadog/tests/test_datadog.py b/products/warehouse_sources/sources/datadog/tests/test_datadog.pyindex 79fe355e393c..84b9d61daad0 100644--- a/products/warehouse_sources/sources/datadog/tests/test_datadog.py+++ b/products/warehouse_sources/sources/datadog/tests/test_datadog.py@@ -4,6 +4,7 @@ from typing import Anyfrom urllib.parse import parse_qs, urlparseimport pytest+import time_machinefrom unittest import mockimport requests@@ -166,6 +167,15 @@ class TestBuildInitialParams:{"start_month": "2026-03"},[],),+ # The endpoint 400s with no params unless start_month/start_date is sent; a bare+ # first sync (no incremental state) must still seed start_month from the lookback.+ (+ "usage_estimated_cost",+ False,+ None,+ {"start_month": "2026-02"},+ [],+ ),],)def test_build_initial_params(@@ -177,11 +187,12 @@ class TestBuildInitialParams:expected_absent: list[str],) -> None:config = DATADOG_ENDPOINTS[endpoint]- params = _build_initial_params(- config,- should_use_incremental_field=should_use_incremental_field,- db_incremental_field_last_value=last_value,- )+ with time_machine.travel(datetime(2026, 3, 4, tzinfo=UTC), tick=False):+ params = _build_initial_params(+ config,+ should_use_incremental_field=should_use_incremental_field,+ db_incremental_field_last_value=last_value,+ )for key, value in expected_present.items():assert params[key] == value