junrao commented on code in PR #14767: URL: https://github.com/apache/kafka/pull/14767#discussion_r1409930152
########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -3697,16 +3698,60 @@ class KafkaApis(val requestChannel: RequestChannel, CompletableFuture.completedFuture[Unit](()) } - // Just a place holder for now. def handleGetTelemetrySubscriptionsRequest(request: RequestChannel.Request): Unit = { - requestHelper.sendMaybeThrottle(request, request.body[GetTelemetrySubscriptionsRequest].getErrorResponse(Errors.UNSUPPORTED_VERSION.exception)) - CompletableFuture.completedFuture[Unit](()) + val subscriptionRequest = request.body[GetTelemetrySubscriptionsRequest] + + if (ClientMetricsReceiverPlugin.instance.isEmpty) { + info("Received get telemetry client request, no metrics receiver plugin configured or running with ZK") + requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => + subscriptionRequest.getErrorResponse(requestThrottleMs, Errors.UNSUPPORTED_VERSION.exception)) Review Comment: Yes, I agree that we need to exclude telemetry requests in `APIVersionsResponse` if ClientMetrics Exporter Plugin is not configured. We could do that by passing in the plugin availability flag through `ApiVersionManager.apiVersionResponse`. ########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -3747,16 +3747,56 @@ class KafkaApis(val requestChannel: RequestChannel, CompletableFuture.completedFuture[Unit](()) } - // Just a place holder for now. def handleGetTelemetrySubscriptionsRequest(request: RequestChannel.Request): Unit = { - requestHelper.sendMaybeThrottle(request, request.body[GetTelemetrySubscriptionsRequest].getErrorResponse(Errors.UNSUPPORTED_VERSION.exception)) - CompletableFuture.completedFuture[Unit](()) + val subscriptionRequest = request.body[GetTelemetrySubscriptionsRequest] + + clientMetricsManager match { + case Some(metricsManager) => + try { + if (metricsManager.isTelemetryReceiverConfigured) { + requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => Review Comment: If we use `sendResponseMaybeThrottle`, we need to set requestThrottleMs in the response. A simpler approach is to use `sendMaybeThrottle`, which automatically sets `requestThrottleMs` in the response. Ditto in other usage. -- 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