junrao commented on code in PR #15190: URL: https://github.com/apache/kafka/pull/15190#discussion_r1456303419
########## core/src/main/scala/kafka/network/SocketServer.scala: ########## @@ -1140,9 +1141,9 @@ private[kafka] class Processor( expiredConnectionsKilledCount.record(null, 1, 0) } else { val connectionId = receive.source - val context = new RequestContext(header, connectionId, channel.socketAddress, - channel.principal, listenerName, securityProtocol, - channel.channelMetadataRegistry.clientInformation, isPrivilegedListener, channel.principalSerde) + val context = new RequestContext(header, connectionId, channel.socketAddress, Optional.of(channel.socketPort()), Review Comment: Hmm, channel.socketPort() is never null. Why do we need to convert it to an Optional? ########## server/src/test/java/org/apache/kafka/server/metrics/ClientMetricsTestUtils.java: ########## @@ -59,6 +60,7 @@ public static RequestContext requestContext() throws UnknownHostException { new RequestHeader(ApiKeys.GET_TELEMETRY_SUBSCRIPTIONS, (short) 0, "producer-1", 0), "1", InetAddress.getLocalHost(), + Optional.of(56078), Review Comment: Could we define a constant for 56078 and reuse? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org