kezhenxu94 commented on a change in pull request #5688:
URL: https://github.com/apache/skywalking/pull/5688#discussion_r507852274



##########
File path: docs/en/setup/service-agent/java-agent/README.md
##########
@@ -89,6 +89,7 @@ property key | Description | Default |
 `osinfo.ipv4_list_size`| Limit the length of the ipv4 list size. |`10`|
 `collector.grpc_channel_check_interval`|grpc channel status check 
interval.|`30`|
 `collector.heartbeat_period`|agent heartbeat report period. Unit, second.|`30`|
+`collector.times_send_properties`|How many times do report a properties to the 
backend, Each time interval is {@link Collector#HEARTBEAT_PERIOD} |`10`|

Review comment:
       It's hard to express this config item properly, but this statement is 
abs. not what you really mean, according to the logic, it should be
   
   ```suggestion
   `collector.times_send_properties`|The agent sends the instance properties to 
the backend every `collector.heartbeat_period * 
collector.times_send_properties` seconds |`10`|
   ```

##########
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:
       Why do you move this `ping` into the `else` block? This should be as 
what it was.




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