zhyyu opened a new issue #7341:
URL: https://github.com/apache/skywalking/issues/7341


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [x] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Bug
   - Which version of SkyWalking, OS, and JRE?
   8.6.0, mac os m1, zulu jdk
   
   - What happened?
   If possible, provide a way to reproduce the error. e.g. demo application, 
component version.
   
![image](https://user-images.githubusercontent.com/22634485/126276034-93d17c0a-793c-4772-8b38-f1d124cc7e3b.png)
   
   if there are 3 mins, and
   1 min: 10000 total request, 0 success match , percentage 0
   2 min: 100 total request, 100 success match, percentage 10000
   3 min: 100 total request, 100 success match, percentage 10000
   
   the result sla in these 3 mins will be 66.66% because of current es 
aggregation, it only avg percentage which is wrong.
   ```
     "aggregations": {
       "entity_id": {
         "terms": {
           "field": "entity_id",
           //...
         },
         "aggregations": {
           "percentage": {
             "avg": {
               "field": "percentage"
             }
           }
         }
       }
   ```
   the accurate sla in these 3 mins should be 1.96% ((0 + 100 + 100) / (10000 + 
100 + 100))
   
   ___
   ### Requirement or improvement
   - Please describe your requirements or improvement suggestions.
   Can we change the es aggregation to it? 
   ```
     "aggregations": {
       "entity_id": {
         "terms": {
           "field": "entity_id",
           //...
         },
         "aggregations": {
           "totalSum": {
             "sum": {
               "field": "total"
             },
           "totalMatch": {
             "sum": {
               "field": "match"
             },
           }
         }
       }
   ```
   Calculate the total sum and total match first, and then operate totalMatch / 
totalSum in the code to get the result sla.
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to