sunithabeeram commented on a change in pull request #3913: Adding the support for sampling logs URL: https://github.com/apache/incubator-pinot/pull/3913#discussion_r263220157
########## File path: pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java ########## @@ -292,21 +298,45 @@ public BrokerResponse handleRequest(JsonNode request, @Nullable RequesterIdentit LOGGER.debug("Broker Response: {}", brokerResponse); - // Table name might have been changed (with suffix _OFFLINE/_REALTIME appended) - LOGGER.info( - "RequestId:{}, table:{}, timeMs:{}, docs:{}/{}, entries:{}/{}, segments(queried/processed/matched):{}/{}/{} " - + "servers:{}/{}, groupLimitReached:{}, exceptions:{}, serverStats:{}, query:{}", requestId, - brokerRequest.getQuerySource().getTableName(), totalTimeMs, brokerResponse.getNumDocsScanned(), - brokerResponse.getTotalDocs(), brokerResponse.getNumEntriesScannedInFilter(), - brokerResponse.getNumEntriesScannedPostFilter(), brokerResponse.getNumSegmentsQueried(), - brokerResponse.getNumSegmentsProcessed(), brokerResponse.getNumSegmentsMatched(), - brokerResponse.getNumServersResponded(), brokerResponse.getNumServersQueried(), - brokerResponse.isNumGroupsLimitReached(), brokerResponse.getExceptionsSize(), serverStats.getServerStats(), - StringUtils.substring(query, 0, _queryLogLength)); - + if(_queryLogRateLimiter.tryAcquire() || forceLog(brokerResponse, totalTimeMs)) { + // Table name might have been changed (with suffix _OFFLINE/_REALTIME appended) + LOGGER.info( + "RequestId:{}, table:{}, timeMs:{}, docs:{}/{}, entries:{}/{}, segments(queried/processed/matched):{}/{}/{} " + + "servers:{}/{}, groupLimitReached:{}, exceptions:{}, serverStats:{}, query:{}", requestId, + brokerRequest.getQuerySource().getTableName(), totalTimeMs, brokerResponse.getNumDocsScanned(), + brokerResponse.getTotalDocs(), brokerResponse.getNumEntriesScannedInFilter(), + brokerResponse.getNumEntriesScannedPostFilter(), brokerResponse.getNumSegmentsQueried(), + brokerResponse.getNumSegmentsProcessed(), brokerResponse.getNumSegmentsMatched(), + brokerResponse.getNumServersResponded(), brokerResponse.getNumServersQueried(), + brokerResponse.isNumGroupsLimitReached(), brokerResponse.getExceptionsSize(), serverStats.getServerStats(), + StringUtils.substring(query, 0, _queryLogLength)); + } Review comment: Could you track how many logs were throttled and log the count (if non-zero) the next time we are able to acquire a permit for logging? Else, it might be quite confusing to users if they expect to see some logs and find no trace of them. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org