k-raina commented on code in PR #20144: URL: https://github.com/apache/kafka/pull/20144#discussion_r2254421825
########## clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryReporter.java: ########## @@ -713,14 +716,23 @@ private Optional<Builder<?>> createPushRequest(ClientTelemetrySubscription local return Optional.empty(); } - CompressionType compressionType = ClientTelemetryUtils.preferredCompressionType(localSubscription.acceptedCompressionTypes()); + CompressionType compressionType = ClientTelemetryUtils.preferredCompressionType(localSubscription.acceptedCompressionTypes(), unsupportedCompressionTypes); ByteBuffer compressedPayload; try { compressedPayload = ClientTelemetryUtils.compress(payload, compressionType); - } catch (Throwable e) { - log.debug("Failed to compress telemetry payload for compression: {}, sending uncompressed data", compressionType); + } catch (IOException e) { + log.debug("Failed to compress telemetry payload for compression: {}, sending uncompressed data", compressionType, e); compressedPayload = ByteBuffer.wrap(payload.toByteArray()); compressionType = CompressionType.NONE; + } catch (Throwable e) { + if (e instanceof NoClassDefFoundError || e.getCause() instanceof NoClassDefFoundError) { + log.debug("Compression library {} not found, sending uncompressed data", compressionType, e); + unsupportedCompressionTypes.add(compressionType); Review Comment: Below are couple of edge case scenarios i can think of where exception will happen: 1. Libraries set by broker missing in client application -> Handled by NoClassDefFoundError 2. Stream Compression failure or protobuf failues -> Handled by IOException 3. Memory overflow like OutOfMemoryError, BufferOverflowException caused due to maybe large metrics data -> Should be thrown as Runtime Exception 4. System or JVM Exceptions like UnsatisfiedLinkError, StackOverflowError -> Should be thrown as Runtime Exception For cases like 3 & 4 Errors seems to be non recoverable, so telemetry will be set to TERMINATED state as mentioned in [comment](https://github.com/apache/kafka/pull/20144#discussion_r2254399569). Please let me know your opinion on this! -- 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