Nikita-Shupletsov commented on code in PR #23452:
URL: https://github.com/apache/kafka/pull/23452#discussion_r4699796458


##########
clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryReporter.java:
##########
@@ -746,6 +750,26 @@ private Optional<Builder<?>> 
createPushRequest(ClientTelemetrySubscription local
                 compressionType = CompressionType.NONE;
             }
 
+            /*
+             Per KIP-714, the payload must not exceed the maximum size the 
broker advertised in the
+             subscription. Sending it anyway would only be rejected with 
TELEMETRY_TOO_LARGE, hence
+             skip the push and re-fetch the subscription, which may narrow the 
requested metrics or
+             raise the limit, before attempting the next push.
+            */
+            if (compressedPayload.remaining() > 
localSubscription.telemetryMaxBytes()) {
+                log.warn("Skipping telemetry push as the {} compressed payload 
for {} metrics is {} bytes,"
+                        + " which exceeds the maximum of {} bytes accepted by 
the broker", compressionType,
+                    metricsCount, compressedPayload.remaining(), 
localSubscription.telemetryMaxBytes());

Review Comment:
   Hi @nileshkumar3.
   There is a KIP: 
https://cwiki.apache.org/confluence/spaces/KAFKA/pages/462817559/KIP-1398+Extending+the+client+telemetry+protocol
   which extends the protocol to have multiple parts per push and a 
deterministic way of dropping metrics
   I think we should hold off on that PR and either drop it in favour of the 
changes coming with the KIP or adjust the approach to align with it. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to