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 2019/08/30 02:57:27 UTC

[GitHub] [skywalking] stalary commented on a change in pull request #3369: ADD kafka-v2 plugin

stalary commented on a change in pull request #3369: ADD kafka-v2 plugin
URL: https://github.com/apache/skywalking/pull/3369#discussion_r319341305
 
 

 ##########
 File path: apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/main/java/org/apache/skywalking/apm/plugin/kafka/v1/KafkaProducerInterceptor.java
 ##########
 @@ -47,22 +47,18 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
 
         ProducerRecord record = (ProducerRecord)allArguments[0];
         String topicName = (String)((EnhancedInstance)record).getSkyWalkingDynamicField();
-
+        String key = record.key() == null ? null : (String) record.key();
         AbstractSpan activeSpan = ContextManager.createExitSpan(OPERATE_NAME_PREFIX + topicName + PRODUCER_OPERATE_NAME_SUFFIX, contextCarrier, (String)objInst.getSkyWalkingDynamicField());
 
-        Tags.MQ_BROKER.set(activeSpan, (String)objInst.getSkyWalkingDynamicField());
+        Tags.MQ_BROKER.set(activeSpan, (String) objInst.getSkyWalkingDynamicField());
         Tags.MQ_TOPIC.set(activeSpan, topicName);
+        Tags.MQ_QUEUE.set(activeSpan, key);
         SpanLayer.asMQ(activeSpan);
         activeSpan.setComponent(ComponentsDefine.KAFKA_PRODUCER);
 
-        CarrierItem next = contextCarrier.items();
-        while (next.hasNext()) {
-            next = next.next();
-            record.headers().add(next.getHeadKey(), next.getHeadValue().getBytes());
 
 Review comment:
   I used kafka-clients of version 0.11.0.3 in my local test, but kafka server use 0.10.0, which will cause error reporting. Do we need to support new clients to connect to old servers?

----------------------------------------------------------------
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


With regards,
Apache Git Services