Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlertQuartz.Consumer#consumer 方法条件判断会出现问题 #267

Closed
zhiyuan192shine opened this issue Nov 21, 2019 · 2 comments
Closed

AlertQuartz.Consumer#consumer 方法条件判断会出现问题 #267

zhiyuan192shine opened this issue Nov 21, 2019 · 2 comments

Comments

@zhiyuan192shine
Copy link

@zhiyuan192shine zhiyuan192shine commented Nov 21, 2019

if (lag > alarmConsumer.getLag() && alarmConsumer.getAlarmTimes() <= alarmConsumer.getAlarmMaxTimes()) {
    // alarm consumer
    alarmConsumer.setAlarmTimes(alarmConsumer.getAlarmTimes() + 1);
    alarmConsumer.setIsNormal("N");
    alertService.modifyConsumerStatusAlertById(alarmConsumer);
    try {
        sendAlarmConsumerError(alarmConfing, alarmConsumer, lag);
    } catch (Exception e) {
        LOG.error("Send alarm consumer exception has error, msg is " + e.getCause().getMessage());
    }
} else {
    if (alarmConsumer.getIsNormal().equals("N")) {
        alarmConsumer.setIsNormal("Y");
        // clear error alarm and reset
        alarmConsumer.setAlarmTimes(0);
        // notify the cancel of the alarm
        alertService.modifyConsumerStatusAlertById(alarmConsumer);
        try {
            sendAlarmConsumerNormal(alarmConfing, alarmConsumer, lag);
        } catch (Exception e) {
            LOG.error("Send alarm consumer normal has error, msg is " + e.getCause().getMessage());
        }
    }
}

alarmConsumer.getAlarmTimes() <= alarmConsumer.getAlarmMaxTimes() 不需要 = , 只需要 < 就行,否会导致 else 代码块执行,出现 lag > lag_threshold 情况仍会被正常告警

@smartloli

This comment has been minimized.

Copy link
Owner

@smartloli smartloli commented Nov 23, 2019

OK, Fixed this bug in the next release.

@smartloli

This comment has been minimized.

Copy link
Owner

@smartloli smartloli commented Nov 26, 2019

fixed by v1.4.1

@smartloli smartloli closed this Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.