: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(error-tracking): make first/last event fetch opt-in (#64648)
Catalin Irimied3899189d25f
diff --git a/products/error_tracking/backend/hogql_queries/error_tracking_query_runner.py b/products/error_tracking/backend/hogql_queries/error_tracking_query_runner.pyindex 489963259604..b18b34d77274 100644--- a/products/error_tracking/backend/hogql_queries/error_tracking_query_runner.py+++ b/products/error_tracking/backend/hogql_queries/error_tracking_query_runner.py@@ -43,8 +43,10 @@ class ErrorTrackingQueryRunner(AnalyticsQueryRunner[ErrorTrackingQueryResponse])if self.query.withAggregations is None:self.query.withAggregations = True+ # First/last event fetches read every matching event's full properties blob, so they+ # must be opted into explicitly rather than defaulting on.if self.query.withFirstEvent is None:- self.query.withFirstEvent = True+ self.query.withFirstEvent = Falseif self.query.withLastEvent is None:self.query.withLastEvent = Falsediff --git a/products/error_tracking/backend/hogql_queries/test/test_error_tracking_query_runner.py b/products/error_tracking/backend/hogql_queries/test/test_error_tracking_query_runner.pyindex 75b69a724d04..cc8b54d3e339 100644--- a/products/error_tracking/backend/hogql_queries/test/test_error_tracking_query_runner.py+++ b/products/error_tracking/backend/hogql_queries/test/test_error_tracking_query_runner.py@@ -304,6 +304,20 @@ class TestErrorTrackingQueryRunner(ClickhouseTestMixin, NonAtomicBaseTestKeepIdeself.assertEqual(date_from, datetime(2022, 1, 9, 12, 11, 0, tzinfo=ZoneInfo(key="UTC")))self.assertEqual(date_to, datetime(2022, 1, 11, 12, 11, 0, tzinfo=ZoneInfo(key="UTC")))+ def test_event_fetching_defaults_off(self):+ runner = ErrorTrackingQueryRunner(+ team=self.team,+ query=ErrorTrackingQuery(+ kind="ErrorTrackingQuery",+ dateRange=DateRange(),+ orderBy="last_seen", # pyright: ignore[reportArgumentType]+ volumeResolution=1,+ ),+ )+ self.assertFalse(runner.query.withFirstEvent)+ self.assertFalse(runner.query.withLastEvent)+ self.assertTrue(runner.query.withAggregations)+@freeze_time("2022-01-10T12:11:00")@snapshot_clickhouse_queriesdef test_issue_grouping(self):