liutang123 commented on a change in pull request #6358:
URL: https://github.com/apache/incubator-doris/pull/6358#discussion_r683173097



##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
##########
@@ -124,10 +125,19 @@ private void auditAfterExec(String origStmt, 
StatementBase parsedStmt, Data.PQue
 
         if (ctx.getState().isQuery()) {
             MetricRepo.COUNTER_QUERY_ALL.increase(1L);
-            if (ctx.getState().getStateType() == QueryState.MysqlStateType.ERR
-                    && ctx.getState().getErrType() != 
QueryState.ErrType.ANALYSIS_ERR) {
-                // err query
-                MetricRepo.COUNTER_QUERY_ERR.increase(1L);
+            if (ctx.getState().getStateType() == 
QueryState.MysqlStateType.ERR) {
+                InternalErrorCode errorCode = 
ctx.getState().getInternalErrorCode();
+                if (errorCode == InternalErrorCode.INTERNAL_ERR) {
+                    // err query
+                    MetricRepo.COUNTER_QUERY_ERR.increase(1L);
+                } else {
+                    MetricRepo.COUNTER_QUERY_ERR_OTHER.increase(1L);
+                    MetricRepo.HISTO_QUERY_LATENCY.update(elapseMs);

Review comment:
       Userexception (timeout, cancel, etc) will be treated as 
`ANALYSIS_ERR`,`ANALYSIS_ERR` will be recorded in the query time. It is 
understandable that a known error query will be recorded in the query time.
   Therefore, this PR still records known errors (timeout, cancel, etc.) in the 
query time, and other errors (RPC, unknown errors) are not recorded in the 
query time.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
##########
@@ -124,10 +125,19 @@ private void auditAfterExec(String origStmt, 
StatementBase parsedStmt, Data.PQue
 
         if (ctx.getState().isQuery()) {
             MetricRepo.COUNTER_QUERY_ALL.increase(1L);
-            if (ctx.getState().getStateType() == QueryState.MysqlStateType.ERR
-                    && ctx.getState().getErrType() != 
QueryState.ErrType.ANALYSIS_ERR) {
-                // err query
-                MetricRepo.COUNTER_QUERY_ERR.increase(1L);
+            if (ctx.getState().getStateType() == 
QueryState.MysqlStateType.ERR) {
+                InternalErrorCode errorCode = 
ctx.getState().getInternalErrorCode();
+                if (errorCode == InternalErrorCode.INTERNAL_ERR) {
+                    // err query
+                    MetricRepo.COUNTER_QUERY_ERR.increase(1L);
+                } else {
+                    MetricRepo.COUNTER_QUERY_ERR_OTHER.increase(1L);
+                    MetricRepo.HISTO_QUERY_LATENCY.update(elapseMs);

Review comment:
       Maybe we can remove this logic and only record the successful query in 
the query time




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to