From 32a93c1ac86bd4b6eab4b8acdd6d9ef206d7678d Mon Sep 17 00:00:00 2001 From: Yang Xiufeng Date: Fri, 26 Aug 2022 17:29:51 +0800 Subject: [PATCH] feat(http_handler): add more log for http query. --- .../service/src/servers/http/v1/http_query_handlers.rs | 9 +++++++++ .../service/src/servers/http/v1/query/execute_state.rs | 4 ++++ .../service/src/servers/http/v1/query/http_query.rs | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/query/service/src/servers/http/v1/http_query_handlers.rs b/src/query/service/src/servers/http/v1/http_query_handlers.rs index de935a7c0210b..086dff9695e1c 100644 --- a/src/query/service/src/servers/http/v1/http_query_handlers.rs +++ b/src/query/service/src/servers/http/v1/http_query_handlers.rs @@ -231,6 +231,7 @@ pub(crate) async fn query_handler( ) -> PoemResult> { info!("receive http query: {:?}", req); let http_query_manager = HttpQueryManager::instance(); + let sql = req.sql.clone(); let query = http_query_manager.try_create_query(ctx, req).await; match query { @@ -240,6 +241,14 @@ pub(crate) async fn query_handler( .await .map_err(|err| poem::Error::from_string(err.message(), StatusCode::NOT_FOUND))?; query.update_expire_time().await; + let (rows, next_page) = match &resp.data { + None => (0, None), + Some(p) => (p.page.data.num_rows(), p.next_page_no), + }; + info!( + "initial response to http query_id={}, state={:?}, rows={}, next_page={:?}, sql='{}'", + &query.id, &resp.state, rows, next_page, sql + ); Ok(Json(QueryResponse::from_internal( query.id.to_string(), resp, diff --git a/src/query/service/src/servers/http/v1/query/execute_state.rs b/src/query/service/src/servers/http/v1/query/execute_state.rs index 727661e2bdfd6..292af5de5a7ca 100644 --- a/src/query/service/src/servers/http/v1/query/execute_state.rs +++ b/src/query/service/src/servers/http/v1/query/execute_state.rs @@ -345,6 +345,9 @@ impl HttpQueryHandle { mut build_res: PipelineBuildResult, result_columns: &[ColumnBinding], ) -> Result { + let id = ctx.get_id(); + tracing::info!("http query_id execute() begin"); + let executor = self.executor.clone(); let block_buffer = self.block_buffer.clone(); @@ -423,6 +426,7 @@ impl HttpQueryHandle { } } }); + tracing::info!("http query {id} execute() end"); Ok(Box::pin(DataBlockStream::create(schema, None, vec![]))) } } diff --git a/src/query/service/src/servers/http/v1/query/http_query.rs b/src/query/service/src/servers/http/v1/query/http_query.rs index d4ef75e9600c9..9f3329815bfae 100644 --- a/src/query/service/src/servers/http/v1/query/http_query.rs +++ b/src/query/service/src/servers/http/v1/query/http_query.rs @@ -219,6 +219,8 @@ impl HttpQuery { let ctx = session.create_query_context().await?; let id = ctx.get_id(); + let sql = &request.sql; + tracing::info!("run query_id={id} in session_id={session_id}, sql='{sql}'"); let block_buffer = BlockBuffer::new(request.pagination.max_rows_in_buffer); let state =