Jackie-Jiang commented on code in PR #15609: URL: https://github.com/apache/pinot/pull/15609#discussion_r2054972689
########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java: ########## @@ -443,11 +443,27 @@ private BrokerResponse query(QueryEnvironment.CompiledQuery query, long requestI Tracing.ThreadAccountantOps.clear(); onQueryFinish(requestId); } - long executionEndTimeNs = System.nanoTime(); - updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, - executionEndTimeNs - executionStartTimeNs); BrokerResponseNativeV2 brokerResponse = new BrokerResponseNativeV2(); + + QueryProcessingException processingException = queryResults.getProcessingException(); + if (processingException != null) { + brokerResponse.addException(processingException); + QueryErrorCode errorCode = QueryErrorCode.fromErrorCode(processingException.getErrorCode()); + if (errorCode == QueryErrorCode.EXECUTION_TIMEOUT) { + for (String table : tableNames) { + _brokerMetrics.addMeteredTableValue(table, BrokerMeter.BROKER_RESPONSES_WITH_TIMEOUTS, 1); + } + LOGGER.warn("Timed out executing request {}: {}", requestId, query); Review Comment: Do we want to log for other exception types? ########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java: ########## @@ -443,11 +443,27 @@ private BrokerResponse query(QueryEnvironment.CompiledQuery query, long requestI Tracing.ThreadAccountantOps.clear(); onQueryFinish(requestId); } - long executionEndTimeNs = System.nanoTime(); - updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, - executionEndTimeNs - executionStartTimeNs); BrokerResponseNativeV2 brokerResponse = new BrokerResponseNativeV2(); + + QueryProcessingException processingException = queryResults.getProcessingException(); + if (processingException != null) { + brokerResponse.addException(processingException); + QueryErrorCode errorCode = QueryErrorCode.fromErrorCode(processingException.getErrorCode()); + if (errorCode == QueryErrorCode.EXECUTION_TIMEOUT) { + for (String table : tableNames) { + _brokerMetrics.addMeteredTableValue(table, BrokerMeter.BROKER_RESPONSES_WITH_TIMEOUTS, 1); + } + LOGGER.warn("Timed out executing request {}: {}", requestId, query); + } + requestContext.setErrorCode(errorCode); + } else { + brokerResponse.setResultTable(queryResults.getResultTable()); + long executionEndTimeNs = System.nanoTime(); + updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, Review Comment: This is a behavior change, where we only track time for success queries ########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java: ########## @@ -443,11 +443,27 @@ private BrokerResponse query(QueryEnvironment.CompiledQuery query, long requestI Tracing.ThreadAccountantOps.clear(); onQueryFinish(requestId); } - long executionEndTimeNs = System.nanoTime(); - updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, - executionEndTimeNs - executionStartTimeNs); BrokerResponseNativeV2 brokerResponse = new BrokerResponseNativeV2(); + + QueryProcessingException processingException = queryResults.getProcessingException(); + if (processingException != null) { + brokerResponse.addException(processingException); + QueryErrorCode errorCode = QueryErrorCode.fromErrorCode(processingException.getErrorCode()); + if (errorCode == QueryErrorCode.EXECUTION_TIMEOUT) { + for (String table : tableNames) { + _brokerMetrics.addMeteredTableValue(table, BrokerMeter.BROKER_RESPONSES_WITH_TIMEOUTS, 1); + } + LOGGER.warn("Timed out executing request {}: {}", requestId, query); + } + requestContext.setErrorCode(errorCode); + } else { + brokerResponse.setResultTable(queryResults.getResultTable()); Review Comment: (minor) This is set on line 468 -- 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...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org