From f30dc2faec12627a4c15c4062912771e04fc2408 Mon Sep 17 00:00:00 2001 From: "Lei, HUANG" Date: Thu, 20 Aug 2026 13:17:59 +0800 Subject: [PATCH] feat: enable live analyze metrics for HTTP SQL requests Without `query.live_analyze_metrics`, both the Flight stream and the in-process region query path only snapshot execution metrics after each produced record batch. A timed out EXPLAIN ANALYZE VERBOSE that is stalled mid-scan therefore records only stale or empty remote (stage 1) metrics in its slow query payload. Enable live analyze metrics for `/v1/sql` requests so 1s-heartbeat metric snapshots keep flowing; all consumers additionally gate on `explain_verbose`, making this a no-op for other statements. Signed-off-by: Lei, HUANG --- src/servers/src/http/handler.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/servers/src/http/handler.rs b/src/servers/src/http/handler.rs index b80d0fe302c..5f446c5f22c 100644 --- a/src/servers/src/http/handler.rs +++ b/src/servers/src/http/handler.rs @@ -148,6 +148,12 @@ pub async fn sql( let db = query_ctx.get_db_string(); query_ctx.set_channel(Channel::HttpSql); + // Enable heartbeat-based live analyze metrics so that a timed out + // EXPLAIN ANALYZE VERBOSE can snapshot fresh execution metrics, instead + // of only the metrics received with the last record batch. All consumers + // additionally gate on `explain_verbose`, so this is a no-op for other + // statements. + query_ctx.enable_live_analyze_metrics(); apply_request_deadline(&query_ctx, deadline); let query_ctx = Arc::new(query_ctx);