Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
5b49f8f9
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 大约 1 年
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
5b49f8f9
编写于
2月 25, 2021
作者:
H
haoyann
提交者:
GitHub
2月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix alarm httpclient connection leak (#6431)
上级
08bceb90
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
56 addition
and
5 deletion
+56
-5
CHANGES.md
CHANGES.md
+1
-0
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallback.java
...lking/oap/server/core/alarm/provider/WebhookCallback.java
+11
-1
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/dingtalk/DingtalkHookCallback.java
...er/core/alarm/provider/dingtalk/DingtalkHookCallback.java
+11
-1
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/feishu/FeishuHookCallback.java
...server/core/alarm/provider/feishu/FeishuHookCallback.java
+11
-1
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/slack/SlackhookCallback.java
...p/server/core/alarm/provider/slack/SlackhookCallback.java
+11
-1
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/wechat/WechatHookCallback.java
...server/core/alarm/provider/wechat/WechatHookCallback.java
+11
-1
未找到文件。
CHANGES.md
浏览文件 @
5b49f8f9
...
...
@@ -29,6 +29,7 @@ Release Notes.
*
Fix kubernetes.client.opeanapi.ApiException.
*
Remove filename suffix in the meter active file config.
*
Introduce log analysis language (LAL).
*
Fix alarm httpclient connection leak.
#### UI
*
Update selector scroller to show in all pages.
...
...
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallback.java
浏览文件 @
5b49f8f9
...
...
@@ -74,10 +74,11 @@ public class WebhookCallback implements AlarmCallback {
post
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
HttpHeaderValues
.
APPLICATION_JSON
.
toString
());
StringEntity
entity
;
CloseableHttpResponse
httpResponse
=
null
;
try
{
entity
=
new
StringEntity
(
gson
.
toJson
(
alarmMessage
),
StandardCharsets
.
UTF_8
);
post
.
setEntity
(
entity
);
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
post
);
httpResponse
=
httpClient
.
execute
(
post
);
StatusLine
statusLine
=
httpResponse
.
getStatusLine
();
if
(
statusLine
!=
null
&&
statusLine
.
getStatusCode
()
!=
HttpStatus
.
SC_OK
)
{
log
.
error
(
"send alarm to "
+
url
+
" failure. Response code: "
+
statusLine
.
getStatusCode
());
...
...
@@ -86,6 +87,15 @@ public class WebhookCallback implements AlarmCallback {
log
.
error
(
"Alarm to JSON error, "
+
e
.
getMessage
(),
e
);
}
catch
(
IOException
e
)
{
log
.
error
(
"send alarm to "
+
url
+
" failure."
,
e
);
}
finally
{
if
(
httpResponse
!=
null
)
{
try
{
httpResponse
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
});
}
finally
{
...
...
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/dingtalk/DingtalkHookCallback.java
浏览文件 @
5b49f8f9
...
...
@@ -134,6 +134,7 @@ public class DingtalkHookCallback implements AlarmCallback {
* Send alarm message to remote endpoint
*/
private
void
sendAlarmMessage
(
CloseableHttpClient
httpClient
,
String
url
,
String
requestBody
)
{
CloseableHttpResponse
httpResponse
=
null
;
try
{
HttpPost
post
=
new
HttpPost
(
url
);
post
.
setConfig
(
requestConfig
);
...
...
@@ -141,7 +142,7 @@ public class DingtalkHookCallback implements AlarmCallback {
post
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
HttpHeaderValues
.
APPLICATION_JSON
.
toString
());
StringEntity
entity
=
new
StringEntity
(
requestBody
,
ContentType
.
APPLICATION_JSON
);
post
.
setEntity
(
entity
);
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
post
);
httpResponse
=
httpClient
.
execute
(
post
);
StatusLine
statusLine
=
httpResponse
.
getStatusLine
();
if
(
statusLine
!=
null
&&
statusLine
.
getStatusCode
()
!=
HttpStatus
.
SC_OK
)
{
log
.
error
(
"send dingtalk alarm to {} failure. Response code: {}, Response content: {}"
,
url
,
statusLine
.
getStatusCode
(),
...
...
@@ -149,6 +150,15 @@ public class DingtalkHookCallback implements AlarmCallback {
}
}
catch
(
Throwable
e
)
{
log
.
error
(
"send dingtalk alarm to {} failure."
,
url
,
e
);
}
finally
{
if
(
httpResponse
!=
null
)
{
try
{
httpResponse
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/feishu/FeishuHookCallback.java
浏览文件 @
5b49f8f9
...
...
@@ -153,6 +153,7 @@ public class FeishuHookCallback implements AlarmCallback {
* Send alarm message to remote endpoint
*/
private
void
sendAlarmMessage
(
CloseableHttpClient
httpClient
,
String
url
,
String
requestBody
)
{
CloseableHttpResponse
httpResponse
=
null
;
try
{
HttpPost
post
=
new
HttpPost
(
url
);
post
.
setConfig
(
requestConfig
);
...
...
@@ -160,7 +161,7 @@ public class FeishuHookCallback implements AlarmCallback {
post
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
HttpHeaderValues
.
APPLICATION_JSON
.
toString
());
StringEntity
entity
=
new
StringEntity
(
requestBody
,
ContentType
.
APPLICATION_JSON
);
post
.
setEntity
(
entity
);
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
post
);
httpResponse
=
httpClient
.
execute
(
post
);
StatusLine
statusLine
=
httpResponse
.
getStatusLine
();
if
(
statusLine
!=
null
&&
statusLine
.
getStatusCode
()
!=
HttpStatus
.
SC_OK
)
{
log
.
error
(
"send feishu alarm to {} failure. Response code: {}, Response content: {}"
,
url
,
statusLine
.
getStatusCode
(),
...
...
@@ -168,6 +169,15 @@ public class FeishuHookCallback implements AlarmCallback {
}
}
catch
(
Throwable
e
)
{
log
.
error
(
"send feishu alarm to {} failure."
,
url
,
e
);
}
finally
{
if
(
httpResponse
!=
null
)
{
try
{
httpResponse
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/slack/SlackhookCallback.java
浏览文件 @
5b49f8f9
...
...
@@ -76,6 +76,7 @@ public class SlackhookCallback implements AlarmCallback {
post
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
HttpHeaderValues
.
APPLICATION_JSON
.
toString
());
StringEntity
entity
;
CloseableHttpResponse
httpResponse
=
null
;
try
{
JsonObject
jsonObject
=
new
JsonObject
();
JsonArray
jsonElements
=
new
JsonArray
();
...
...
@@ -88,7 +89,7 @@ public class SlackhookCallback implements AlarmCallback {
jsonObject
.
add
(
"blocks"
,
jsonElements
);
entity
=
new
StringEntity
(
GSON
.
toJson
(
jsonObject
),
ContentType
.
APPLICATION_JSON
);
post
.
setEntity
(
entity
);
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
post
);
httpResponse
=
httpClient
.
execute
(
post
);
StatusLine
statusLine
=
httpResponse
.
getStatusLine
();
if
(
statusLine
!=
null
&&
statusLine
.
getStatusCode
()
!=
HttpStatus
.
SC_OK
)
{
log
.
error
(
"Send slack alarm to {} failure. Response code: {}"
,
url
,
statusLine
.
getStatusCode
());
...
...
@@ -97,6 +98,15 @@ public class SlackhookCallback implements AlarmCallback {
log
.
error
(
"Alarm to JSON error, {} "
,
e
.
getMessage
(),
e
);
}
catch
(
IOException
e
)
{
log
.
error
(
"Send slack alarm to {} failure."
,
url
,
e
);
}
finally
{
if
(
httpResponse
!=
null
)
{
try
{
httpResponse
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
});
}
finally
{
...
...
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/wechat/WechatHookCallback.java
浏览文件 @
5b49f8f9
...
...
@@ -82,6 +82,7 @@ public class WechatHookCallback implements AlarmCallback {
}
private
void
sendAlarmMessage
(
CloseableHttpClient
httpClient
,
String
url
,
String
requestBody
)
{
CloseableHttpResponse
httpResponse
=
null
;
try
{
HttpPost
post
=
new
HttpPost
(
url
);
post
.
setConfig
(
requestConfig
);
...
...
@@ -89,13 +90,22 @@ public class WechatHookCallback implements AlarmCallback {
post
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
HttpHeaderValues
.
APPLICATION_JSON
.
toString
());
StringEntity
entity
=
new
StringEntity
(
requestBody
,
ContentType
.
APPLICATION_JSON
);
post
.
setEntity
(
entity
);
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
post
);
httpResponse
=
httpClient
.
execute
(
post
);
StatusLine
statusLine
=
httpResponse
.
getStatusLine
();
if
(
statusLine
!=
null
&&
statusLine
.
getStatusCode
()
!=
HttpStatus
.
SC_OK
)
{
log
.
error
(
"send wechat alarm to {} failure. Response code: {} "
,
url
,
statusLine
.
getStatusCode
());
}
}
catch
(
Throwable
e
)
{
log
.
error
(
"send wechat alarm to {} failure."
,
url
,
e
);
}
finally
{
if
(
httpResponse
!=
null
)
{
try
{
httpResponse
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录