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


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   OAP server (apache/skywalking)
   
   ### What happened
   
   when there were all errors in one minute, the app error rate was 0%, the 
correct should be 100%.
   
![image](https://user-images.githubusercontent.com/22634485/134445085-645504fc-fbac-4f6c-9fe2-6d9a2aff561a.png)
   
![image](https://user-images.githubusercontent.com/22634485/134445115-c508dcb8-5651-41ab-bec3-c73fcca96575.png)
   
   and when the errors count were two times to normal pv, the app error rate 
was 200%, the correct shoud be 66%.
   
![image](https://user-images.githubusercontent.com/22634485/134445365-4c201e9f-4cd8-40d2-bbdc-88beea3575a0.png)
   
   I checked the oal script and found that
   ```
   browser_app_error_rate = from(BrowserAppTraffic.*).rate(trafficCategory == 
BrowserAppTrafficCategory.FIRST_ERROR,trafficCategory == 
BrowserAppTrafficCategory.NORMAL);
   ```
   
   and corresponding the oal generated dispatcher is
   ```
   private void doBrowserAppErrorRate(BrowserAppTraffic var1) {
           BrowserAppErrorRateMetrics var2 = new BrowserAppErrorRateMetrics();
           var2.setTimeBucket(var1.getTimeBucket());
           var2.setEntityId(var1.getEntityId());
           var2.combine((new EqualMatch()).match(var1.getTrafficCategory(), 
BrowserAppTrafficCategory.FIRST_ERROR), (new 
EqualMatch()).match(var1.getTrafficCategory(), 
BrowserAppTrafficCategory.NORMAL));
           MetricsStreamProcessor.getInstance().in(var2);
       }
   ```
   
   I think the second parameter should be 1, so that `RateMetrics` can work 
right, the browser app error rate will be less equal than 100%, and will not be 
0 when there are all errors.
   
   ### What you expected to happen
   
   I expect 100% error rate when there are all errors in one minute; and expect 
error rate not over 100%.
   
   ### How to reproduce
   
   1. In one minutes, only produce errorLogs, and then there will be only error 
count, but error rate to zero.
   2. In one minutes, produce errorLogs two times to normal perfData, and then 
the error rate will be 200%.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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