: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
feat(web-analytics): tag no-join overview executions with their own query type (#70934)
Lucas Ricoya3096d7cc883
diff --git a/products/web_analytics/backend/hogql_queries/test/test_web_overview.py b/products/web_analytics/backend/hogql_queries/test/test_web_overview.pyindex 40dbab2aeb39..815da9495a19 100644--- a/products/web_analytics/backend/hogql_queries/test/test_web_overview.py+++ b/products/web_analytics/backend/hogql_queries/test/test_web_overview.py@@ -1152,3 +1152,22 @@ class TestWebOverviewNoJoinRolloutPercent(ClickhouseTestMixin, APIBaseTest):def test_allowlist_wins_regardless_of_percent(self):with override_settings(WEB_ANALYTICS_NO_JOIN_TEAM_IDS=[self.team.pk], WEB_ANALYTICS_NO_JOIN_ROLLOUT_PERCENT=0):assert self._runner().should_skip_session_join++ def test_no_join_executions_emit_their_own_query_type_tag(self):+ from posthog.hogql import query as hogql_query_module++ with override_settings(WEB_ANALYTICS_NO_JOIN_TEAM_IDS=[self.team.pk], WEB_ANALYTICS_NO_JOIN_ROLLOUT_PERCENT=0):+ with patch(+ "products.web_analytics.backend.hogql_queries.web_overview.execute_hogql_query",+ wraps=hogql_query_module.execute_hogql_query,+ ) as spy:+ self._runner().calculate()+ assert spy.call_args.kwargs["query_type"] == "web_overview_no_join_query"++ with override_settings(WEB_ANALYTICS_NO_JOIN_TEAM_IDS=[], WEB_ANALYTICS_NO_JOIN_ROLLOUT_PERCENT=0):+ with patch(+ "products.web_analytics.backend.hogql_queries.web_overview.execute_hogql_query",+ wraps=hogql_query_module.execute_hogql_query,+ ) as spy:+ self._runner().calculate()+ assert spy.call_args.kwargs["query_type"] == "web_overview_query"diff --git a/products/web_analytics/backend/hogql_queries/web_overview.py b/products/web_analytics/backend/hogql_queries/web_overview.pyindex 9b55e065b8db..441fe2041b93 100644--- a/products/web_analytics/backend/hogql_queries/web_overview.py+++ b/products/web_analytics/backend/hogql_queries/web_overview.py@@ -252,7 +252,9 @@ CROSS JOIN {sessions_agg} AS sessions_aggresponse = (execute_hogql_query(- query_type="web_overview_query",+ # Distinct tag for the fast path so query_log analysis doesn't need+ # to text-match the SQL shape (see /evaluating-web-analytics-performance).+ query_type="web_overview_no_join_query" if self.should_skip_session_join else "web_overview_query",query=self.to_query(),team=self.team,user=self.user,diff --git a/products/web_analytics/dags/cache_warming.py b/products/web_analytics/dags/cache_warming.pyindex 22bc7f724b83..90bfec6861a5 100644--- a/products/web_analytics/dags/cache_warming.py+++ b/products/web_analytics/dags/cache_warming.py@@ -112,11 +112,12 @@ def queries_to_keep_fresh(AND team_id = %(team_id)sAND (startsWith(query_type, 'stats_table_')+ -- Overview strategy variants get their own tags (no_join today,+ -- two_phase next); prefix-match like stats_table_ so new variants+ -- can't silently fall out of warming.+ OR startsWith(query_type, 'web_overview_')OR query_type IN ('web_goals_query',- 'web_overview_preaggregated_query',- 'web_overview_query',- 'web_overview_lazy_query','web_stats_paths_lazy_query','web_vitals_path_breakdown_query','web_vitals_paths_lazy_query',