wujimin commented on a change in pull request #1012: [SCB-1044]add current 
process CPU rate  and net packets in the metrics
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1012#discussion_r238156023
 
 

 ##########
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/DefaultLogPublisher.java
 ##########
 @@ -161,8 +166,14 @@ private void printNetLog(StringBuilder sb, 
MeasurementNode osNode) {
 
   private void printCpuLog(StringBuilder sb, MeasurementNode osNode) {
     MeasurementNode cpuNode = osNode.findChild(OsMeter.OS_TYPE_CPU);
-    if (cpuNode != null && !cpuNode.getMeasurements().isEmpty()) {
-      appendLine(sb, "  cpu: %.2f%%", cpuNode.summary() * 100);
+    if (cpuNode == null || cpuNode.getMeasurements().isEmpty()) {
+      return;
+    }
+    double allRate = cpuNode.findChild(CpuMeter.TAG_All.value()).summary();
+    double processRate = 
cpuNode.findChild(CpuMeter.TAG_CURRENT.value()).summary();
+    if (allRate != 0 || processRate != 0) {
 
 Review comment:
   always print cpu usage.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to