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 2018/04/03 07:43:45 UTC

[GitHub] wu-sheng commented on a change in pull request #1018: avoid "by zero" exception when all request are error

wu-sheng commented on a change in pull request #1018: avoid "by zero"  exception when all request are error
URL: https://github.com/apache/incubator-skywalking/pull/1018#discussion_r178737496
 
 

 ##########
 File path: apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServiceTopologyService.java
 ##########
 @@ -86,7 +86,11 @@ public Topology getServiceTopology(Step step, int serviceId, long startTimeBucke
             Call call = new Call();
             call.setSource(referenceMetric.getSource());
             call.setTarget(referenceMetric.getTarget());
-            call.setAvgResponseTime((referenceMetric.getDurations() - referenceMetric.getErrorDurations()) / (referenceMetric.getCalls() - referenceMetric.getErrorCalls()));
+            if (referenceMetric.getCalls() == referenceMetric.getErrorCalls()) {
+                call.setAvgResponseTime(referenceMetric.getDurations() / referenceMetric.getCalls());
 
 Review comment:
   This process way has conflicts with other. If all requests are error, the avg response time should be 0.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services