: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(query-performance): show funnel order type in slowest queries metric tag (#65696)
Juraj Majerik7a8c2098cc26
diff --git a/frontend/src/scenes/instance/QueryPerformance/QueryPerformance.tsx b/frontend/src/scenes/instance/QueryPerformance/QueryPerformance.tsxindex 8ca33bc8f11b..fa9a4d4f9dcc 100644--- a/frontend/src/scenes/instance/QueryPerformance/QueryPerformance.tsx+++ b/frontend/src/scenes/instance/QueryPerformance/QueryPerformance.tsx@@ -186,10 +186,14 @@ export function QueryPerformance(): JSX.Element {{title: 'Metric',render: function Metric(_, item) {+ const metricTypeLabel =+ item.experiment_metric_type === 'funnel' && item.experiment_funnel_order_type+ ? `funnel:${item.experiment_funnel_order_type}`+ : item.experiment_metric_typereturn (<div className="flex items-center gap-1"><span>{item.experiment_metric_name}</span>- {item.experiment_metric_type && <LemonTag type="muted">{item.experiment_metric_type}</LemonTag>}+ {item.experiment_metric_type && <LemonTag type="muted">{metricTypeLabel}</LemonTag>}</div>)},diff --git a/frontend/src/scenes/instance/QueryPerformance/queryPerformanceLogic.ts b/frontend/src/scenes/instance/QueryPerformance/queryPerformanceLogic.tsindex 033a9a96f9e2..95336a09f801 100644--- a/frontend/src/scenes/instance/QueryPerformance/queryPerformanceLogic.ts+++ b/frontend/src/scenes/instance/QueryPerformance/queryPerformanceLogic.ts@@ -35,6 +35,7 @@ export interface SlowestQuery {experiment_query_surface: stringexperiment_precompute_table: stringexperiment_metric_type: string+ experiment_funnel_order_type: string | nullexperiment_id: number | null}diff --git a/posthog/api/debug_ch_queries.py b/posthog/api/debug_ch_queries.pyindex a0257b3a9bbe..86d5a34a07e7 100644--- a/posthog/api/debug_ch_queries.py+++ b/posthog/api/debug_ch_queries.py@@ -418,6 +418,7 @@ class DebugCHQueries(viewsets.ViewSet):argMax(JSONExtractString(log_comment, 'experiment_metric_name'), type) AS experiment_metric_name,argMax(JSONExtractString(log_comment, 'experiment_execution_path'), type) AS experiment_execution_path,argMax(JSONExtractString(log_comment, 'experiment_metric_type'), type) AS experiment_metric_type,+ argMax(JSONExtractString(log_comment, 'experiment_funnel_order_type'), type) AS experiment_funnel_order_type,argMax(JSONExtractInt(log_comment, 'experiment_id'), type) AS experiment_id,argMax(JSONExtractString(log_comment, 'experiment_exposures_path'), type) AS experiment_exposures_path,argMax(JSONExtractString(log_comment, 'experiment_metric_events_path'), type) AS experiment_metric_events_path,@@ -478,11 +479,12 @@ class DebugCHQueries(viewsets.ViewSet):"experiment_metric_name": row[9],"experiment_execution_path": row[10],"experiment_metric_type": row[11],- "experiment_id": row[12] or None,- "experiment_exposures_path": row[13],- "experiment_metric_events_path": row[14],- "experiment_query_surface": row[15],- "experiment_precompute_table": row[16],+ "experiment_funnel_order_type": row[12] or None,+ "experiment_id": row[13] or None,+ "experiment_exposures_path": row[14],+ "experiment_metric_events_path": row[15],+ "experiment_query_surface": row[16],+ "experiment_precompute_table": row[17],}for row in response]diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.pyindex b1307d3e8f8b..0e19cb36c1e0 100644--- a/posthog/clickhouse/query_tagging.py+++ b/posthog/clickhouse/query_tagging.py@@ -418,6 +418,7 @@ class QueryTags(BaseModel):experiment_metric_uuid: Optional[str] = Noneexperiment_metric_name: Optional[str] = Noneexperiment_metric_type: Optional[str] = None # "mean", "funnel", "ratio", "retention"+ experiment_funnel_order_type: Optional[str] = None # funnel metrics only: "ordered", "unordered", "strict"# DEPRECATED: alias of experiment_exposures_path, kept so external tooling keeps working.experiment_execution_path: Optional[str] = None # "direct_scan" or "precomputed"experiment_exposures_path: Optional[str] = None # "direct_scan" or "precomputed"diff --git a/products/experiments/backend/hogql_queries/experiment_query_runner.py b/products/experiments/backend/hogql_queries/experiment_query_runner.pyindex 3b1612b1fa0e..1aec10016815 100644--- a/products/experiments/backend/hogql_queries/experiment_query_runner.py+++ b/products/experiments/backend/hogql_queries/experiment_query_runner.py@@ -434,6 +434,8 @@ class ExperimentQueryRunner(QueryRunner):experiment_metric_name=metric_name,experiment_metric_type=self.metric.metric_type,)+ if isinstance(self.metric, ExperimentFunnelMetric):+ tag_queries(experiment_funnel_order_type=self.metric.funnel_order_type or "ordered")experiment_query_ast = self._get_experiment_query()