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

 ##########
 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:
   That is not our job. It is Kafka requirement. Nothing more.
   
   If you want, feel free to update document to indicate server version 
requirement. But it is pointless to make us support less versions tham before. 
If this change lands, we have broken trace for sure even server is already 0.11+

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to