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 2021/05/24 10:10:49 UTC
[GitHub] [skywalking] zhyyu opened a new issue #7000: The meaning of 'Counter' variable in RunningRule
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:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng closed issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7000:
URL: https://github.com/apache/skywalking/issues/7000
--
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:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7000:
URL: https://github.com/apache/skywalking/issues/7000#issuecomment-847532024
OK, this makes sense now. We don't need `counter`, this is actually a duplicate logic bug.
Are you going to send a pull request to fix this?
--
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:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng closed issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7000:
URL: https://github.com/apache/skywalking/issues/7000
--
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:
users@infra.apache.org
[GitHub] [skywalking] zhyyu edited a comment on issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
zhyyu edited a comment on issue #7000:
URL: https://github.com/apache/skywalking/issues/7000#issuecomment-847478291
Ok, I think it's a bug; The default alarm-settings.yml
```
service_resp_time_rule:
metrics-name: service_resp_time
op: ">"
threshold: 1000
period: 10
count: 3
silence-period: 5
message: Response time of service {name} is more than 1000ms in 3 minutes of last 10 minutes.
```
if 1, 2, 3 minutes metrics match the threshold, it will not triggered immediately. It hava to wait 3 more minutes to wait for triggering because of 'Counter' compare 'countThreshold' twice in the source code. So the default rule message is not accurate.
--
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:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7000:
URL: https://github.com/apache/skywalking/issues/7000#issuecomment-846947598
I think you should not ask a community to explain the source codes to you. If you find a bug, we could dive in.
--
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:
users@infra.apache.org
[GitHub] [skywalking] zhyyu commented on issue #7000: The meaning of 'Counter' variable in RunningRule
Posted by GitBox <gi...@apache.org>.
zhyyu commented on issue #7000:
URL: https://github.com/apache/skywalking/issues/7000#issuecomment-847478291
Ok, I think it's a bug; The default alarm-settings.yml
```
service_resp_time_rule:
metrics-name: service_resp_time
op: ">"
threshold: 1000
period: 10
count: 3
silence-period: 5
message: Response time of service {name} is more than 1000ms in 3 minutes of last 10 minutes.
```
if 1, 2, 3 minutes metrics match the threshold, it will not triggered. It hava to wait 3 more minutes to wait for triggering because of 'Counter' compare 'countThreshold' twice in the source code. So the default rule message is not accurate.
--
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:
users@infra.apache.org