chia7712 commented on code in PR #17578:
URL: https://github.com/apache/kafka/pull/17578#discussion_r1813314319
##########
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:
@clarkwtc we should add new helper method to compress `MetricsData`
directly. for example:
```java
public static byte[] compress(MetricsData payload, CompressionType
compressionType) throws IOException {
try (ByteBufferOutputStream compressedOut = new
ByteBufferOutputStream(512)) {
Compression compression =
Compression.of(compressionType).build();
try (OutputStream out = compression.wrapForOutput(compressedOut,
RecordBatch.CURRENT_MAGIC_VALUE)) {
payload.writeTo(out);
}
compressedOut.buffer().flip();
return Utils.toArray(compressedOut.buffer());
}
}
```
--
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]