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

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

commit 3e0211577f0aeca84890260f1089e8c80011e652
Author: CritasWang <[email protected]>
AuthorDate: Wed Aug 13 10:31:14 2025 +0800

    fix FAST_LAST_QUERY metrics, using the same StatementType
---
 .../iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java  | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 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..7110d6373eb 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,19 +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 (queryId != null) {
         if (finish) {
           long executionTime = COORDINATOR.getTotalExecutionTime(queryId);
-          CommonUtils.addQueryLatency(
-              statement != null ? statement.getType() : null,
-              executionTime > 0 ? executionTime : costTime);
+          CommonUtils.addQueryLatency(statementType, executionTime > 0 ? 
executionTime : costTime);
         }
         COORDINATOR.cleanupQueryExecution(queryId);
       }

Reply via email to