This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new fe3205cd32b fix FAST_LAST_QUERY metrics, using the same StatementType
fe3205cd32b is described below

commit fe3205cd32bdd47e4e9133235c4df563a01827d6
Author: CritasWang <[email protected]>
AuthorDate: Wed Aug 13 10:49:52 2025 +0800

    fix FAST_LAST_QUERY metrics, using the same StatementType
---
 .../db/protocol/rest/v2/impl/RestApiServiceImpl.java   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
index efdabe0f793..7c52c9b7bc5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
@@ -205,20 +205,18 @@ public class RestApiServiceImpl extends RestApiService {
       return 
Response.ok().entity(ExceptionHandler.tryCatchException(e)).build();
     } finally {
       long costTime = System.nanoTime() - startTime;
-      String statementType =
+
+      StatementType statementType =
           Optional.ofNullable(statement)
-              .map(s -> s.getType().name())
-              .orElse(StatementType.FAST_LAST_QUERY.name());
+              .map(s -> s.getType())
+              .orElse(StatementType.FAST_LAST_QUERY);
 
       CommonUtils.addStatementExecutionLatency(
-          OperationType.EXECUTE_QUERY_STATEMENT, statementType, costTime);
+          OperationType.EXECUTE_QUERY_STATEMENT, statementType.name(), 
costTime);
+      if (finish) {
+        CommonUtils.addQueryLatency(statementType, costTime);
+      }
       if (queryId != null) {
-        if (finish) {
-          long executionTime = COORDINATOR.getTotalExecutionTime(queryId);
-          CommonUtils.addQueryLatency(
-              statement != null ? statement.getType() : null,
-              executionTime > 0 ? executionTime : costTime);
-        }
         COORDINATOR.cleanupQueryExecution(queryId);
       }
     }

Reply via email to