[ 
https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16706776#comment-16706776
 ] 

ASF GitHub Bot commented on SCB-1044:
-------------------------------------

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

 ##########
 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:
   ok

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


> add current process CPU rate  and net packets in the metrics
> ------------------------------------------------------------
>
>                 Key: SCB-1044
>                 URL: https://issues.apache.org/jira/browse/SCB-1044
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: 何一乐
>            Assignee: 何一乐
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to