You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/07/11 23:43:01 UTC
[GitHub] [pinot] vvivekiyer commented on a diff in pull request #8907: Log Request header for Broker
vvivekiyer commented on code in PR #8907:
URL: https://github.com/apache/pinot/pull/8907#discussion_r918430094
##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -658,9 +661,32 @@ private boolean isFilterAlwaysTrue(PinotQuery pinotQuery) {
}
private void logBrokerResponse(long requestId, String query, RequestContext requestContext, String tableName,
- int numUnavailableSegments, ServerStats serverStats, BrokerResponseNative brokerResponse, long totalTimeMs) {
+ int numUnavailableSegments, ServerStats serverStats, BrokerResponseNative brokerResponse, long totalTimeMs,
+ @Nullable RequesterIdentity requesterIdentity) {
LOGGER.debug("Broker Response: {}", brokerResponse);
+ boolean enableClientIpLogging = _config.getProperty(Broker.CONFIG_OF_BROKER_REQUEST_CLIENT_IP_LOGGING,
+ Broker.DEFAULT_BROKER_REQUEST_CLIENT_IP_LOGGING);
+ String clientIp = "";
+ // If reverse proxy is used X-Forwarded-For will be populated
+ // If X-Forwarded-For is not present, check if x-real-ip is present
+ // Since X-Forwarded-For can contain comma separated list of values, we convert it to ";" delimiter to avoid
+ // downstream parsing errors for other fields where "," is being used
+ if (enableClientIpLogging && requesterIdentity != null) {
+ for (Map.Entry<String, String> entries : ((HttpRequesterIdentity) requesterIdentity).getHttpHeaders().entries()) {
Review Comment:
nit: entry
--
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-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org