-
Notifications
You must be signed in to change notification settings - Fork 5k
[Feature-14832][Listener]Implementation of Listener Mechanism #14981
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
Conversation
|
|
|
Due to OSPP time constraints, some improments need to be done in future PRs.
|
dolphinscheduler-ui/src/views/security/alarm-instance-manage/detail.tsx
Outdated
Show resolved
Hide resolved
| globalAlertGroup.setAlertInstanceIds(String.valueOf(alertPluginInstance.getId())); | ||
| } else { | ||
| List<Integer> ids = Arrays.stream(globalAlertGroup.getAlertInstanceIds().split(",")) | ||
| .map(s -> Integer.parseInt(s.trim())) |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException
| // global instance will be removed from global alert group automatically | ||
| AlertGroup globalAlertGroup = alertGroupMapper.selectById(2); | ||
| List<Integer> ids = Arrays.stream(globalAlertGroup.getAlertInstanceIds().split(",")) | ||
| .map(s -> Integer.parseInt(s.trim())) |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException
...c/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.java
Fixed
Show fixed
Hide fixed
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
Outdated
Show resolved
Hide resolved
2. front-end: change to ternary expression 3. back-end: correct license header in ListenerEvent.java
f3a3f3c to
4d9195d
Compare
5a1de0d to
6fce2f3
Compare
Codecov Report
@@ Coverage Diff @@
## dev #14981 +/- ##
============================================
+ Coverage 37.80% 38.11% +0.31%
- Complexity 4596 4643 +47
============================================
Files 1248 1262 +14
Lines 44711 45155 +444
Branches 4912 4944 +32
============================================
+ Hits 16903 17211 +308
- Misses 25928 26050 +122
- Partials 1880 1894 +14
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
SbloodyS
left a comment
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.
Generally LGTM. Just some NIT.
...heduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ListenerEventType.java
Outdated
Show resolved
Hide resolved
...server/src/main/java/org/apache/dolphinscheduler/alert/service/ListenerEventPostService.java
Outdated
Show resolved
Hide resolved
...server/src/main/java/org/apache/dolphinscheduler/alert/service/ListenerEventPostService.java
Outdated
Show resolved
Hide resolved
...server/src/main/java/org/apache/dolphinscheduler/alert/service/ListenerEventPostService.java
Outdated
Show resolved
Hide resolved
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
Outdated
Show resolved
Hide resolved
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
Outdated
Show resolved
Hide resolved
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
Outdated
Show resolved
Hide resolved
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.java
Outdated
Show resolved
Hide resolved
| listenerEventAlertManager.publishProcessDefinitionCreatedListenerEvent(loginUser, processDefinition, | ||
| taskDefinitionLogs, | ||
| taskRelationList); |
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.
Can we put this in audit aspect?
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.
Do you mean to add annotation on the methods where generate events to make publish events unified? I think it's hard. Because we cannot get enougn information from arguments and return value of the method for most events such as ProcessStartListenerEvent, ProcessDefinitionDeletedListenerEvent.
|
SonarCloud Quality Gate failed.
|
|
LGTM |
SbloodyS
left a comment
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.
+1
…#14981) * first commit * 1. sql: sync ddl 2. front-end: change to ternary expression 3. back-end: correct license header in ListenerEvent.java * test case * frontend: remove unnecessary console * fix unit test * remove log depends on user-provided value * fix dolphinscheduler_postgresql.sql * sync database schema * fix unit test * fix unit test * fix some NIT. * extract GLOBAL_ALERT_GROUP_ID into variable * fix ddl bug * add column task_type in t_ds_fav_task in upgrade/3.2.0_schema * add unit test










This closes #14832
Purpose of the pull request
This pull request adds a new type of alert plugin instance: global alert plugin instance. The global alert plugin instance will receive and post all system-generated events by default. Now support 10 types of events.
Brief change log
add a global alert group (id: 2) which users cannot modify/delete, the global alert instance will be added into/ removed from this group automatically.

In addition to the original alarm instance type, add a new option for global alarm instances.

add 10 types of events:
ServerDownListenerEvent,ProcessDefinitionCreatedLitenerEvent,ProcessDefinitionUpdatedLitenerEvent,ProcessDefinitionDeletedLitenerEvent,ProcessStartListenerEvent,ProcessEndListenerEvent,ProcessFailListenerEvent,TaskStartListenerEvent,TaskEndListenerEvent,TaskFailListenerEvent. The event will be saved in tablet_ds_listener_event.In addition to
AlertBootstrapService, addListenerEventPostServiceinAlertServer: get pending listener events fromt_ds_listener_event, get global alert instances and post these events.database change
t_ds_alertgroupinstance_type,warning_typeint_ds_alert_plugin_instance.alert instance type: 0 normal; 1 global.warning_type: warning type of normal alert instance which existed inplugin_instance_paramspreviously.t_ds_listener_event: save global listener events, which is simpler thant_ds_alert.Brief change log