: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(metrics): stop exposing observed_timestamp in hogql metrics tables (#126540)
Daniel Viscaa9dc6d482742
diff --git a/posthog/hogql/database/schema/metrics.py b/posthog/hogql/database/schema/metrics.pyindex ef6699a07859..7c97a20099fc 100644--- a/posthog/hogql/database/schema/metrics.py+++ b/posthog/hogql/database/schema/metrics.py@@ -55,11 +55,6 @@ class MetricsTable(Table):"timestamp": DateTimeDatabaseField(name="timestamp", nullable=False, description="When the metric data point was recorded."),- "observed_timestamp": DateTimeDatabaseField(- name="observed_timestamp",- nullable=False,- description="When the collector observed/ingested the data point.",- ),"original_expiry_timestamp": DateTimeDatabaseField(name="original_expiry_timestamp", nullable=False, description="When the data point leaves retention."),@@ -191,11 +186,6 @@ class MetricSamplesTable(Table):"timestamp_arr": DateTimeArrayDatabaseField(name="timestamp_arr", nullable=False, description="When each data point was recorded."),- "observed_timestamp_arr": DateTimeArrayDatabaseField(- name="observed_timestamp_arr",- nullable=False,- description="When the collector observed each data point.",- ),"value_arr": FloatArrayDatabaseField(name="value_arr", nullable=False, description="Numeric value of each data point (for gauge/sum metrics)."),diff --git a/posthog/hogql/transforms/test/test_metrics_time_bucket_bounds.py b/posthog/hogql/transforms/test/test_metrics_time_bucket_bounds.pyindex 7094736911d6..2486284baca3 100644--- a/posthog/hogql/transforms/test/test_metrics_time_bucket_bounds.py+++ b/posthog/hogql/transforms/test/test_metrics_time_bucket_bounds.py@@ -36,7 +36,7 @@ class TestMetricsTimeBucketBounds(BaseTest):@parameterized.expand([- ("column_bound", "SELECT count() FROM posthog.metrics WHERE timestamp >= observed_timestamp"),+ ("column_bound", "SELECT count() FROM posthog.metrics WHERE timestamp >= original_expiry_timestamp"),("inside_or", "SELECT count() FROM posthog.metrics WHERE timestamp >= now() OR value > 1"),("equality", "SELECT count() FROM posthog.metrics WHERE timestamp = now()"),("other_table", "SELECT count() FROM events WHERE timestamp >= now()"),diff --git a/products/metrics/backend/metrics4_samples.py b/products/metrics/backend/metrics4_samples.pyindex 18518ffb6ee4..0aba0fccf5d4 100644--- a/products/metrics/backend/metrics4_samples.py+++ b/products/metrics/backend/metrics4_samples.py@@ -26,7 +26,6 @@ METRICS_RETENTION = dt.timedelta(days=DEFAULT_RETENTION_DAYS)# Each point column of `metrics` maps to one array of `metric_samples`._POINT_ARRAYS: dict[str, str] = {"timestamp": "timestamp_arr",- "observed_timestamp": "observed_timestamp_arr","value": "value_arr","count": "count_arr","histogram_counts": "histogram_counts_arr",