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/09/01 08:24:07 UTC

[GitHub] [skywalking] stalary commented on a change in pull request #3390: MOD: Modify compatibility of kafka plugin and expand operationName

stalary commented on a change in pull request #3390: MOD: Modify compatibility of kafka plugin and expand operationName
URL: https://github.com/apache/skywalking/pull/3390#discussion_r319748946
 
 

 ##########
 File path: apm-sniffer/apm-sdk-plugin/kafka-plugin/src/main/java/org/apache/skywalking/apm/plugin/kafka/KafkaProducerInterceptor.java
 ##########
 @@ -41,16 +42,16 @@
 
     @Override
     public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
-        MethodInterceptResult result) throws Throwable {
+                             MethodInterceptResult result) throws Throwable {
 
         ContextCarrier contextCarrier = new ContextCarrier();
 
-        ProducerRecord record = (ProducerRecord)allArguments[0];
-        String topicName = (String)((EnhancedInstance)record).getSkyWalkingDynamicField();
-
-        AbstractSpan activeSpan = ContextManager.createExitSpan(OPERATE_NAME_PREFIX + topicName + PRODUCER_OPERATE_NAME_SUFFIX, contextCarrier, (String)objInst.getSkyWalkingDynamicField());
+        ProducerRecord record = (ProducerRecord) allArguments[0];
+        String topicName = record.topic();
+        String key = record.key() == null ? null : (String) record.key();
+        AbstractSpan activeSpan = ContextManager.createExitSpan(OPERATE_NAME_PREFIX + topicName + "/" + key + PRODUCER_OPERATE_NAME_SUFFIX, contextCarrier, (String) objInst.getSkyWalkingDynamicField());
 
 Review comment:
   Ok, I'm going to change that

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