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


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [x] Question or discussion
   - [ ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
     - org.apache.skywalking.oap.server.core.alarm.provider.RunningRule
                - what do variable 'Counter' mean?
                - why need a Counter variable?
                - the method 'isMatch' use the 'countThreshold' variable, but 
method 'checkAlarm' also use the 'countThreshold' varaible to compare, I cannot 
understant why compare it twice.
   
   ```java
   public Optional<AlarmMessage> checkAlarm() {
               if (isMatch()) {
                   /*
                    * When
                    * 1. Metrics value threshold triggers alarm by rule
                    * 2. Counter reaches the count threshold;
                    * 3. Isn't in silence stage, judged by 
SilenceCountdown(!=0).
                    */
                   counter++;
                   if (counter >= countThreshold && silenceCountdown < 1) {
                       silenceCountdown = silencePeriod;
                       return Optional.of(new AlarmMessage());
                   } else {
                       silenceCountdown--;
                   }
               } else {
                   silenceCountdown--;
                   if (counter > 0) {
                       counter--;
                   }
               }
               return Optional.empty();
           }
   
   private boolean isMatch() {
               int matchCount = 0;
               for (Metrics metrics : values) {
                   if (metrics == null) {
                       continue;
                   }
   
               // xxx
               // xxx
               
               // Reach the threshold in current bucket.
               return matchCount >= countThreshold;
           }
   ```
   
   ___
   ### Requirement or improvement
   - Please describe your requirements or improvement suggestions.
        - There is a example:
                - window size: 5
                - window threshold: 3
                - initial window data: 0 1 1 0 1 (0 means not matched, 1 means 
matched), and later data is all 0 when window move
        - this example rule will not be triggered by followed rule
          - window size: 5
          - window threshold: 3
        - I think it should be triggered, but it's not. So it confuse me a lot.


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

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


Reply via email to