This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch caLastOpt in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 76a3ecbd5aeee3126a0dbdec728bb3ed2b65609a Author: JackieTien97 <[email protected]> AuthorDate: Thu May 11 14:52:25 2023 +0800 correct metric --- .../iotdb/db/service/thrift/impl/ClientRPCServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/ClientRPCServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/ClientRPCServiceImpl.java index 5d1456935b3..89cacc2361d 100644 --- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/ClientRPCServiceImpl.java +++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/ClientRPCServiceImpl.java @@ -374,6 +374,7 @@ public class ClientRPCServiceImpl implements IClientRPCServiceWithHandler { return RpcUtils.getTSExecuteStatementResp(getNotLoggedInStatus()); } long startTime = System.currentTimeMillis(); + long startNanoTime = System.nanoTime(); Throwable t = null; try { Statement s = StatementGenerator.createStatement(req, clientSession.getZoneId()); @@ -436,7 +437,7 @@ public class ClientRPCServiceImpl implements IClientRPCServiceWithHandler { addStatementExecutionLatency( OperationType.EXECUTE_LAST_DATA_QUERY, StatementType.QUERY, - COORDINATOR.getTotalExecutionTime(queryId)); + System.nanoTime() - startNanoTime); COORDINATOR.cleanupQueryExecution(queryId, t); } SESSION_MANAGER.updateIdleTime(); @@ -2168,6 +2169,11 @@ public class ClientRPCServiceImpl implements IClientRPCServiceWithHandler { /** Add stat of operation into metrics */ private void addStatementExecutionLatency( OperationType operation, StatementType statementType, long costTime) { + addStatementExecutionLatency(operation, statementType, costTime, TimeUnit.MILLISECONDS); + } + + private void addStatementExecutionLatency( + OperationType operation, StatementType statementType, long costTime, TimeUnit timeUnit) { if (statementType == null) { return; } @@ -2175,7 +2181,7 @@ public class ClientRPCServiceImpl implements IClientRPCServiceWithHandler { MetricService.getInstance() .timer( costTime, - TimeUnit.MILLISECONDS, + timeUnit, Metric.PERFORMANCE_OVERVIEW.toString(), MetricLevel.CORE, Tag.INTERFACE.toString(),
