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

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

commit b7b05559446e6143c708cf0cfe66098483976d90
Author: Minghui Liu <[email protected]>
AuthorDate: Mon Nov 7 11:01:25 2022 +0800

    add metrics (Dispatcher)
---
 .../java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index 8c48c6a574..6ba4449df0 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -58,6 +58,7 @@ import 
org.apache.iotdb.db.mpp.plan.statement.crud.InsertBaseStatement;
 import org.apache.iotdb.db.mpp.plan.statement.crud.InsertMultiTabletsStatement;
 import org.apache.iotdb.db.mpp.plan.statement.crud.InsertRowsStatement;
 import org.apache.iotdb.db.mpp.plan.statement.crud.LoadTsFileStatement;
+import org.apache.iotdb.db.mpp.statistics.QueryStatistics;
 import org.apache.iotdb.db.utils.SetThreadName;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
@@ -266,6 +267,7 @@ public class QueryExecution implements IQueryExecution {
       return;
     }
     // TODO: (xingtanzjr) initialize the query scheduler according to 
configuration
+    long startTime = System.nanoTime();
     this.scheduler =
         config.isClusterMode()
             ? new ClusterScheduler(
@@ -285,6 +287,9 @@ public class QueryExecution implements IQueryExecution {
                 scheduledExecutor,
                 internalServiceClientManager);
     this.scheduler.start();
+    if (rawStatement.isQuery()) {
+      QueryStatistics.getInstance().addCost("Dispatcher", System.nanoTime() - 
startTime);
+    }
   }
 
   // Use LogicalPlanner to do the logical query plan and logical optimization

Reply via email to