Force UTF-8 encoding in `JsonLogHandler` of `kafka-fetcher-plugin`. (#9927)

This commit is contained in:
吴晟 Wu Sheng 2022-11-09 14:00:19 +08:00 committed by GitHub
parent 9139a8f0cb
commit a386853bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -103,6 +103,7 @@
* Fix `ClassCastException` in `LoggingConfigWatcher`.
* Support span attached event concept in Zipkin and SkyWalking trace query.
* Support span attached events on Zipkin lens UI.
* Force UTF-8 encoding in `JsonLogHandler` of `kafka-fetcher-plugin`.
#### UI

View File

@ -19,6 +19,7 @@ package org.apache.skywalking.oap.server.analyzer.agent.kafka.provider.handler;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.utils.Bytes;
@ -50,7 +51,7 @@ public class JsonLogHandler extends LogHandler {
@Override
protected LogData parseConsumerRecord(ConsumerRecord<String, Bytes> record) throws IOException {
LogData.Builder logDataBuilder = LogData.newBuilder();
ProtoBufJsonUtils.fromJSON(record.value().toString(), logDataBuilder);
ProtoBufJsonUtils.fromJSON(new String(record.value().get(), StandardCharsets.UTF_8), logDataBuilder);
return logDataBuilder.build();
}
}