Skip to content

: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.

fix(phai): tag Max insight query executions as posthog_ai source (#69288)

Georgiy Tarasov9e1eae8c417c
diff --git a/ee/hogai/context/insight/query_executor.py b/ee/hogai/context/insight/query_executor.py
index 77f7f062d88a..98a84ff2e91b 100644
--- a/ee/hogai/context/insight/query_executor.py
+++ b/ee/hogai/context/insight/query_executor.py
@@ -49,6 +49,7 @@ from posthog.api.services.query import process_query_dict
from posthog.clickhouse.client.execute_async import get_query_status
from posthog.clickhouse.query_tagging import Feature, Product, get_query_tags, tag_queries, tags_context
from posthog.errors import ExposedCHQueryError
+from posthog.event_usage import EventSource
from posthog.hogql_queries.query_runner import BLOCKING_EXECUTION_MODES, ExecutionMode
from posthog.models import Team
from posthog.rbac.user_access_control import UserAccessControlError
@@ -342,6 +343,7 @@ class AssistantQueryExecutor:
execution_mode=execution_mode,
limit_context=LimitContext.POSTHOG_AI,
user=user,
+ analytics_props={"source": EventSource.POSTHOG_AI},
)
# If the query has a blocking execution, execute on a separate thread. Otherwise, use the main thread