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 <ratuthomm@gmail.com>
This commit is contained in:
Lei, HUANG
2026-08-20 13:17:59 +08:00
parent 0196baa11c
commit f30dc2faec
+6
View File
@@ -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);