muse-dev[bot] commented on a change in pull request #5688:
URL: https://github.com/apache/skywalking/pull/5688#discussion_r507620143



##########
File path: 
apm-sniffer/optional-reporter-plugins/kafka-reporter-plugin/src/main/java/org/apache/skywalking/apm/agent/core/kafka/KafkaServiceManagementServiceClient.java
##########
@@ -85,28 +87,32 @@ public void boot() {
             this,
             t -> LOGGER.error("unexpected exception.", t)
         ), 0, Config.Collector.HEARTBEAT_PERIOD, TimeUnit.SECONDS);
-
-        InstanceProperties instance = InstanceProperties.newBuilder()
-                                                        
.setService(Config.Agent.SERVICE_NAME)
-                                                        
.setServiceInstance(Config.Agent.INSTANCE_NAME)
-                                                        
.addAllProperties(OSUtil.buildOSInfo(
-                                                            
Config.OsInfo.IPV4_LIST_SIZE))
-                                                        
.addAllProperties(SERVICE_INSTANCE_PROPERTIES)
-                                                        .build();
-        producer.send(new ProducerRecord<>(topic, TOPIC_KEY_REGISTER + 
instance.getServiceInstance(), Bytes.wrap(instance.toByteArray())));
-        producer.flush();
     }
 
     @Override
     public void run() {
-        InstancePingPkg ping = InstancePingPkg.newBuilder()
-                                              
.setService(Config.Agent.SERVICE_NAME)
-                                              
.setServiceInstance(Config.Agent.INSTANCE_NAME)
-                                              .build();
-        if (LOGGER.isDebugEnable()) {
-            LOGGER.debug("Heartbeat reporting, instance: {}", 
ping.getServiceInstance());
+        if (Math.abs(sendPropertiesCounter.getAndAdd(1)) % 
Config.Collector.TIMES_SEND_PROPERTIES == 0) {
+            InstanceProperties instance = InstanceProperties.newBuilder()
+                                                            
.setService(Config.Agent.SERVICE_NAME)
+                                                            
.setServiceInstance(Config.Agent.INSTANCE_NAME)
+                                                            
.addAllProperties(OSUtil.buildOSInfo(
+                                                                
Config.OsInfo.IPV4_LIST_SIZE))
+                                                            
.addAllProperties(SERVICE_INSTANCE_PROPERTIES)
+                                                            .build();
+            producer.send(new ProducerRecord<>(topic, TOPIC_KEY_REGISTER + 
instance.getServiceInstance(),

Review comment:
       *FutureReturnValueIgnored:*  Return value of methods returning Future 
must be checked. Ignoring returned Futures suppresses exceptions thrown from 
the code that completes the Future.

##########
File path: 
apm-sniffer/optional-reporter-plugins/kafka-reporter-plugin/src/main/java/org/apache/skywalking/apm/agent/core/kafka/KafkaServiceManagementServiceClient.java
##########
@@ -85,28 +87,32 @@ public void boot() {
             this,
             t -> LOGGER.error("unexpected exception.", t)
         ), 0, Config.Collector.HEARTBEAT_PERIOD, TimeUnit.SECONDS);
-
-        InstanceProperties instance = InstanceProperties.newBuilder()
-                                                        
.setService(Config.Agent.SERVICE_NAME)
-                                                        
.setServiceInstance(Config.Agent.INSTANCE_NAME)
-                                                        
.addAllProperties(OSUtil.buildOSInfo(
-                                                            
Config.OsInfo.IPV4_LIST_SIZE))
-                                                        
.addAllProperties(SERVICE_INSTANCE_PROPERTIES)
-                                                        .build();
-        producer.send(new ProducerRecord<>(topic, TOPIC_KEY_REGISTER + 
instance.getServiceInstance(), Bytes.wrap(instance.toByteArray())));
-        producer.flush();
     }
 
     @Override
     public void run() {
-        InstancePingPkg ping = InstancePingPkg.newBuilder()
-                                              
.setService(Config.Agent.SERVICE_NAME)
-                                              
.setServiceInstance(Config.Agent.INSTANCE_NAME)
-                                              .build();
-        if (LOGGER.isDebugEnable()) {
-            LOGGER.debug("Heartbeat reporting, instance: {}", 
ping.getServiceInstance());
+        if (Math.abs(sendPropertiesCounter.getAndAdd(1)) % 
Config.Collector.TIMES_SEND_PROPERTIES == 0) {
+            InstanceProperties instance = InstanceProperties.newBuilder()
+                                                            
.setService(Config.Agent.SERVICE_NAME)
+                                                            
.setServiceInstance(Config.Agent.INSTANCE_NAME)
+                                                            
.addAllProperties(OSUtil.buildOSInfo(
+                                                                
Config.OsInfo.IPV4_LIST_SIZE))
+                                                            
.addAllProperties(SERVICE_INSTANCE_PROPERTIES)
+                                                            .build();
+            producer.send(new ProducerRecord<>(topic, TOPIC_KEY_REGISTER + 
instance.getServiceInstance(),
+                                               
Bytes.wrap(instance.toByteArray())
+            ));
+            producer.flush();
+        } else {
+            InstancePingPkg ping = InstancePingPkg.newBuilder()
+                                                  
.setService(Config.Agent.SERVICE_NAME)
+                                                  
.setServiceInstance(Config.Agent.INSTANCE_NAME)
+                                                  .build();
+            if (LOGGER.isDebugEnable()) {
+                LOGGER.debug("Heartbeat reporting, instance: {}", 
ping.getServiceInstance());
+            }
+            producer.send(new ProducerRecord<>(topic, 
ping.getServiceInstance(), Bytes.wrap(ping.toByteArray())));

Review comment:
       *FutureReturnValueIgnored:*  Return value of methods returning Future 
must be checked. Ignoring returned Futures suppresses exceptions thrown from 
the code that completes the Future.




----------------------------------------------------------------
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:
[email protected]


Reply via email to