apoorvmittal10 commented on code in PR #17578:
URL: https://github.com/apache/kafka/pull/17578#discussion_r1810973171
##########
clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryReporter.java:
##########
@@ -707,7 +708,8 @@ private Optional<Builder<?>>
createPushRequest(ClientTelemetrySubscription local
try (MetricsEmitter emitter = new
ClientTelemetryEmitter(localSubscription.selector(),
localSubscription.deltaTemporality())) {
emitter.init();
kafkaMetricsCollector.collect(emitter);
- payload = createPayload(emitter.emittedMetrics());
+ MetricsData payloadMetricsData =
createPayload(emitter.emittedMetrics());
+ payload = compressPayload(payloadMetricsData);
Review Comment:
What did we save with this approach?
##########
clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryReporter.java:
##########
@@ -862,14 +864,20 @@ private void handleFailedRequest(boolean shouldWait) {
}
}
- private byte[] createPayload(List<SinglePointMetric> emittedMetrics) {
+ private MetricsData createPayload(List<SinglePointMetric>
emittedMetrics) {
MetricsData.Builder builder = MetricsData.newBuilder();
emittedMetrics.forEach(metric -> {
Metric m = metric.builder().build();
ResourceMetrics rm = buildMetric(m);
builder.addResourceMetrics(rm);
});
- return builder.build().toByteArray();
+ return builder.build();
+ }
+
+ private byte[] compressPayload(MetricsData payload) throws IOException
{
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ payload.writeTo(outputStream);
+ return outputStream.toByteArray();
Review Comment:
Is it really compression?
--
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]