cyberdak commented on issue #939: [collector] '/ by zero'  error in 5.0.0-alpha
URL: 
https://github.com/apache/incubator-skywalking/issues/939#issuecomment-374518819
 
 
   review the code , the question is here
   ```data
   
         {
           "_index" : "instance_metric_day",
           "_type" : "type",
           "_id" : "20180313_4_1",
           "_score" : 1.0,
           "_source" : {
             "transaction_duration_sum" : 101,
             "metric_id" : "4_1",
             "mq_transaction_duration_sum" : 0,
             "mq_transaction_average_duration" : 0,
             "business_transaction_calls" : 4,
             **"transaction_calls" : 4,**
             "business_transaction_error_calls" : 0,
             "business_transaction_duration_sum" : 0,
             "application_id" : 2,
             **"transaction_error_calls" : 4,**
             "business_transaction_error_duration_sum" : 0,
             "instance_id" : 4,
             "transaction_average_duration" : 25,
             "time_bucket" : 20180313,
             "business_transaction_average_duration" : 0,
             "mq_transaction_calls" : 0,
             "transaction_error_duration_sum" : 101,
             "mq_transaction_error_calls" : 0,
             "source_value" : 1,
             "mq_transaction_error_duration_sum" : 0
           }
         }
   ```
   
   ```java
                   long callTimes = 
((Number)response.getResponse().getSource().get(InstanceMetricTable.COLUMN_TRANSACTION_CALLS)).longValue();
                   long errorCallTimes = 
((Number)response.getResponse().getSource().get(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)).longValue();
                   long durationSum = 
((Number)response.getResponse().getSource().get(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)).longValue();
                   long errorDurationSum = 
((Number)response.getResponse().getSource().get(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)).longValue();
   responseTimeTrends.add((int)((durationSum - errorDurationSum) / (callTimes - 
errorCallTimes)));
   ```
   if all call is error,that will cause this error.
   
   i think it should return 0 or errorCallDurationAvg.

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