: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(web-analytics): tag product and feature in base query runner (#59148)
Lucas Ricoy91ca3324d0b9
diff --git a/posthog/hogql_queries/web_analytics/web_analytics_query_runner.py b/posthog/hogql_queries/web_analytics/web_analytics_query_runner.pyindex 16dad6974514..09c796d1d200 100644--- a/posthog/hogql_queries/web_analytics/web_analytics_query_runner.py+++ b/posthog/hogql_queries/web_analytics/web_analytics_query_runner.py@@ -35,7 +35,7 @@ from posthog.hogql.property import action_to_expr, apply_path_cleaning, propertyfrom posthog.hogql.query import execute_hogql_queryfrom posthog.caching.insights_api import BASE_MINIMUM_INSIGHT_REFRESH_INTERVAL, REDUCED_MINIMUM_INSIGHT_REFRESH_INTERVAL-from posthog.clickhouse.query_tagging import get_query_tag_value, tag_queries+from posthog.clickhouse.query_tagging import Feature, Product, get_query_tag_value, tag_queriesfrom posthog.hogql_queries.query_runner import AnalyticsQueryResponseProtocol, AnalyticsQueryRunnerfrom posthog.hogql_queries.utils.query_compare_to_date_range import QueryCompareToDateRangefrom posthog.hogql_queries.utils.query_date_range import QueryDateRange@@ -82,6 +82,12 @@ class WebAnalyticsQueryRunner(AnalyticsQueryRunner[WAR], ABC):return user_access_control.assert_access_level_for_resource("web_analytics", "viewer")def calculate(self) -> WAR:+ # Every web analytics query runner produces user-facing dashboard+ # queries. Tag here so all downstream `sync_execute` calls (live and+ # preagg paths) inherit product/feature and don't trip DEBUG-mode+ # `UntaggedQueryError`.+ tag_queries(product=Product.WEB_ANALYTICS, feature=Feature.QUERY)+query_kind = getattr(self.query, "kind", "Unknown")breakdown_value = getattr(self.query, "breakdownBy", None)breakdown_label = breakdown_value.value if breakdown_value is not None else "none"