k-raina commented on code in PR #20144: URL: https://github.com/apache/kafka/pull/20144#discussion_r2258038334
########## clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryReporter.java: ########## @@ -379,14 +382,25 @@ public Optional<AbstractRequest.Builder<?>> createRequest() { } finally { lock.readLock().unlock(); } - - if (localState == ClientTelemetryState.SUBSCRIPTION_NEEDED) { - return createSubscriptionRequest(localSubscription); - } else if (localState == ClientTelemetryState.PUSH_NEEDED || localState == ClientTelemetryState.TERMINATING_PUSH_NEEDED) { - return createPushRequest(localSubscription); + + try { + if (localState == ClientTelemetryState.SUBSCRIPTION_NEEDED) { + return createSubscriptionRequest(localSubscription); + } else if (localState == ClientTelemetryState.PUSH_NEEDED || localState == ClientTelemetryState.TERMINATING_PUSH_NEEDED) { + return createPushRequest(localSubscription); + } + log.warn("Cannot make telemetry request as telemetry is in state: {}", localState); + } catch (RuntimeException e) { + // Transition to TERMINATED state to prevent further attempts + lock.writeLock().lock(); + try { + state = ClientTelemetryState.TERMINATED; + } finally { + lock.writeLock().unlock(); + } + log.error("Fatal telemetry error encountered, disabling telemetry permanently: {}", e.getMessage()); Review Comment: @apoorvmittal10 Mentioned in comment https://github.com/apache/kafka/pull/20144#discussion_r2254399569 -- 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