Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
三久
DolphinScheduler
提交
caa6287d
DolphinScheduler
项目概览
三久
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
caa6287d
编写于
8月 01, 2022
作者:
W
Wenjun Ruan
提交者:
GitHub
8月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add alertPluginInstanceId in AlertInfo (#11231)
上级
9a53c6ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
25 deletion
+16
-25
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java
...a/org/apache/dolphinscheduler/alert/api/AlertChannel.java
+3
-1
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java
...java/org/apache/dolphinscheduler/alert/api/AlertInfo.java
+2
-0
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java
...org/apache/dolphinscheduler/alert/AlertSenderService.java
+11
-24
未找到文件。
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java
浏览文件 @
caa6287d
...
...
@@ -19,6 +19,8 @@
package
org.apache.dolphinscheduler.alert.api
;
import
lombok.NonNull
;
/**
* alert channel for sending alerts
*/
...
...
@@ -31,7 +33,7 @@ public interface AlertChannel {
*/
AlertResult
process
(
AlertInfo
info
);
default
AlertResult
closeAlert
(
AlertInfo
info
)
{
default
@NonNull
AlertResult
closeAlert
(
AlertInfo
info
)
{
return
new
AlertResult
(
"true"
,
"no need to close alert"
);
}
}
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java
浏览文件 @
caa6287d
...
...
@@ -39,4 +39,6 @@ public class AlertInfo {
private
AlertData
alertData
;
private
int
alertPluginInstanceId
;
}
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java
浏览文件 @
caa6287d
...
...
@@ -233,12 +233,13 @@ public final class AlertSenderService extends Thread {
}
AlertInfo
alertInfo
=
AlertInfo
.
builder
()
.
alertData
(
alertData
)
.
alertParams
(
paramsMap
)
.
build
();
.
alertData
(
alertData
)
.
alertParams
(
paramsMap
)
.
alertPluginInstanceId
(
instance
.
getId
())
.
build
();
int
waitTimeout
=
alertConfig
.
getWaitTimeout
();
AlertResult
alertResult
;
try
{
AlertResult
alertResult
;
if
(
waitTimeout
<=
0
)
{
if
(
alertData
.
getAlertType
()
==
AlertType
.
CLOSE_ALERT
.
getCode
())
{
alertResult
=
alertChannel
.
closeAlert
(
alertInfo
);
...
...
@@ -254,31 +255,17 @@ public final class AlertSenderService extends Thread {
}
alertResult
=
future
.
get
(
waitTimeout
,
TimeUnit
.
MILLISECONDS
);
}
if
(
alertResult
==
null
)
{
throw
new
RuntimeException
(
"Alert result cannot be null"
);
}
return
alertResult
;
}
catch
(
InterruptedException
e
)
{
alertResult
=
new
AlertResult
(
"false"
,
e
.
getMessage
());
logger
.
error
(
"send alert error alert data id :{},"
,
alertData
.
getId
(),
e
);
Thread
.
currentThread
().
interrupt
();
return
new
AlertResult
(
"false"
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
alertResult
=
new
AlertResult
(
"false"
,
e
.
getMessage
());
logger
.
error
(
"send alert error alert data id :{},"
,
alertData
.
getId
(),
e
);
return
new
AlertResult
(
"false"
,
e
.
getMessage
());
}
AlertResult
alertResultExtend
=
new
AlertResult
();
if
(
alertResult
==
null
)
{
String
message
=
String
.
format
(
"Alert Plugin %s send error : return alertResult value is null"
,
pluginInstanceName
);
alertResultExtend
.
setStatus
(
"false"
);
alertResultExtend
.
setMessage
(
message
);
logger
.
info
(
"Alert Plugin {} send error : return alertResult value is null"
,
pluginInstanceName
);
}
else
if
(!
Boolean
.
parseBoolean
(
String
.
valueOf
(
alertResult
.
getStatus
())))
{
alertResultExtend
.
setStatus
(
"false"
);
alertResultExtend
.
setMessage
(
alertResult
.
getMessage
());
logger
.
info
(
"Alert Plugin {} send error : {}"
,
pluginInstanceName
,
alertResult
.
getMessage
());
}
else
{
String
message
=
String
.
format
(
"Alert Plugin %s send success"
,
pluginInstanceName
);
alertResultExtend
.
setStatus
(
"true"
);
alertResultExtend
.
setMessage
(
message
);
logger
.
info
(
"Alert Plugin {} send success"
,
pluginInstanceName
);
}
return
alertResultExtend
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录