-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Improve] Refactor the notification sending logic. #2180
Conversation
Support jacoco and Codecov
# Conflicts: # collector/src/test/java/org/apache/hertzbeat/collector/util/JsonPathParserTest.java
# Conflicts: # pom.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
matchNoticeRulesByAlert(alert).ifPresent(noticeRules -> { | ||
noticeRules.forEach(rule -> { | ||
workerPool.executeNotify(() -> { | ||
rule.getReceiverId().stream().filter(receiverId -> rule.getTemplateId() != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, the code logic here is to filter out cases where the template id is null, but before the template id was null it would go to use the default file notification template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the reminder. I adjusted the logic;
I moved the template query earlier so it can return exceptions faster, and the code can be more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm👍
Refactor the notification sending logic.
I noticed that most of the
AlertNotifyHandlers
require the use ofNoticeTemplate
, so I directly filtered out the data with nulltemplateId
, making the code more concise.Checklist
Add or update API