You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/11/06 08:08:23 UTC
[GitHub] [skywalking] wu-sheng commented on a change in pull request #5760: Catch all exception when consume kafka record
wu-sheng commented on a change in pull request #5760:
URL: https://github.com/apache/skywalking/pull/5760#discussion_r518583373
##########
File path: oap-server/server-fetcher-plugin/kafka-fetcher-plugin/src/main/java/org/apache/skywalking/oap/server/analyzer/agent/kafka/KafkaFetcherHandlerRegister.java
##########
@@ -132,14 +132,23 @@ public void start() {
@Override
public void run() {
while (true) {
- ConsumerRecords<String, Bytes> consumerRecords = consumer.poll(Duration.ofMillis(500L));
- if (!consumerRecords.isEmpty()) {
- Iterator<ConsumerRecord<String, Bytes>> iterator = consumerRecords.iterator();
- while (iterator.hasNext()) {
- ConsumerRecord<String, Bytes> record = iterator.next();
- handlerMap.get(record.topic()).handle(record);
+ try {
+ ConsumerRecords<String, Bytes> consumerRecords = consumer.poll(Duration.ofMillis(500L));
+ if (!consumerRecords.isEmpty()) {
+ Iterator<ConsumerRecord<String, Bytes>> iterator = consumerRecords.iterator();
+ while (iterator.hasNext()) {
+ ConsumerRecord<String, Bytes> record = iterator.next();
+ try {
+ handlerMap.get(record.topic()).handle(record);
+ } catch (Throwable e) {
+ log.error("process record error, topic:{}, key:{}, value:{}", record.topic(), record.key(), record.value());
+ log.error("process record error", e);
Review comment:
Logging data actually isn't useful.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org