Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
e5188c99
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
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 搜索 >>
提交
e5188c99
编写于
12月 22, 2015
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.增加异常忽略逻辑,可以根据制定情况忽略制定的Exception列表。多个Exception可以使用逗号分隔。需要配置异常全名
上级
8ec5d16d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
34 deletion
+50
-34
samples/skywalking-auth/src/main/resources/sky-walking.auth
samples/skywalking-auth/src/main/resources/sky-walking.auth
+6
-6
skywalking-api/src/main/java/com/ai/cloud/skywalking/buriedpoint/ApplicationExceptionHandler.java
...d/skywalking/buriedpoint/ApplicationExceptionHandler.java
+17
-12
skywalking-api/src/main/java/com/ai/cloud/skywalking/conf/Config.java
...pi/src/main/java/com/ai/cloud/skywalking/conf/Config.java
+1
-0
skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
.../src/main/java/com/ai/cloud/skywalking/protocol/Span.java
+26
-16
未找到文件。
samples/skywalking-auth/src/main/resources/sky-walking.auth
浏览文件 @
e5188c99
#skyWalking用户ID
+++++
#skyWalking用户ID
skywalking.user_id=123
#skyWalking应用ID
+++++
skywalking.application_
id
=test
#skyWalking应用ID
skywalking.application_
code
=test
#是否打印数据
buriedpoint.printf=false
...
...
@@ -18,7 +18,7 @@ sender.servers_addr=127.0.0.1:34000
sender.max_copy_num=2
#发送的最大长度
sender.max_send_length=20000
#当没有Sender时,尝试获取sender的等待周期
+++++
#当没有Sender时,尝试获取sender的等待周期
sender.retry_get_sender_wait_interval=2000
#是否开启发送消息
sender.is_off=false
...
...
@@ -28,7 +28,7 @@ sender.is_off=false
consumer.max_consumer=2
#消费者最大等待时间
consumer.max_wait_time=5
#发送失败等待时间
+++++++
#发送失败等待时间
consumer.consumer_fail_retry_wait_interval=50
#每个Buffer的最大个数
...
...
@@ -36,6 +36,6 @@ buffer.buffer_max_size=18000
#Buffer池的最大长度
buffer.pool_size=5
#发送检查线程检查周期
++++++++
#发送检查线程检查周期
senderchecker.check_polling_time=200
skywalking-api/src/main/java/com/ai/cloud/skywalking/buriedpoint/ApplicationExceptionHandler.java
浏览文件 @
e5188c99
package
com.ai.cloud.skywalking.buriedpoint
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
com
.
ai
.
cloud
.
skywalking
.
conf
.
Config
.
BuriedPoint
.
EXCLUSIVE_EXCEPTIONS
;
import
java.util.HashSet
;
import
java.util.Set
;
import
com.ai.cloud.skywalking.api.IExceptionHandler
;
import
com.ai.cloud.skywalking.conf.Config
;
...
...
@@ -9,22 +11,25 @@ import com.ai.cloud.skywalking.context.Context;
import
com.ai.cloud.skywalking.protocol.Span
;
public
class
ApplicationExceptionHandler
implements
IExceptionHandler
{
private
static
Boolean
isExclusiveExceptionListInit
=
false
;
private
static
List
<
String
>
exclusiveExceptionList
=
new
ArrayList
<
String
>()
;
private
static
String
EXCEPTION_SPLIT
=
","
;
private
static
Set
<
String
>
exclusiveExceptionSet
=
null
;
@Override
public
void
handleException
(
Throwable
th
)
{
if
(
isExclusiveExceptionListInit
==
false
)
synchronized
(
isExclusiveExceptionListInit
)
{
if
(
isExclusiveExceptionListInit
==
false
)
{
isExclusiveExceptionListInit
=
true
;
}
if
(
exclusiveExceptionSet
==
null
)
{
Set
<
String
>
exclusiveExceptions
=
new
HashSet
<
String
>();
String
[]
exceptions
=
EXCLUSIVE_EXCEPTIONS
.
split
(
EXCEPTION_SPLIT
);
for
(
String
exception
:
exceptions
){
exclusiveExceptions
.
add
(
exception
);
}
exclusiveExceptionSet
=
exclusiveExceptions
;
}
Span
span
=
Context
.
getLastSpan
();
span
.
handleException
(
th
,
exclusiveExceptionList
,
Config
.
BuriedPoint
.
MAX_EXCEPTION_STACK_LENGTH
);
span
.
handleException
(
th
,
exclusiveExceptionSet
,
Config
.
BuriedPoint
.
MAX_EXCEPTION_STACK_LENGTH
);
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/conf/Config.java
浏览文件 @
e5188c99
...
...
@@ -17,6 +17,7 @@ public class Config {
// Business Key 最大长度
public
static
int
BUSINESSKEY_MAX_LENGTH
=
300
;
// 使用逗号分离
public
static
String
EXCLUSIVE_EXCEPTIONS
=
""
;
}
...
...
skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
浏览文件 @
e5188c99
...
...
@@ -2,8 +2,7 @@ package com.ai.cloud.skywalking.protocol;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -137,24 +136,35 @@ public class Span extends SpanData {
return
str
!=
null
&&
str
.
length
()
>
0
;
}
public
void
handleException
(
Throwable
e
,
List
<
String
>
exclusiveExceptionList
,
int
maxExceptionStackLength
)
{
this
.
statusCode
=
1
;
ByteArrayOutputStream
buf
=
new
ByteArrayOutputStream
();
public
void
handleException
(
Throwable
e
,
Set
<
String
>
exclusiveExceptionSet
,
int
maxExceptionStackLength
)
{
ByteArrayOutputStream
buf
=
null
;
StringBuilder
expMessage
=
new
StringBuilder
();
Throwable
causeException
=
e
;
while
(
causeException
!=
null
&&
(
causeException
.
getCause
()
!=
null
||
expMessage
.
length
()
<
maxExceptionStackLength
))
{
causeException
.
printStackTrace
(
new
java
.
io
.
PrintWriter
(
buf
,
true
));
expMessage
.
append
(
buf
.
toString
());
causeException
=
causeException
.
getCause
();
}
try
{
buf
.
close
();
}
catch
(
IOException
e1
)
{
logger
.
log
(
Level
.
ALL
,
"Close exception stack input stream failed"
);
buf
=
new
ByteArrayOutputStream
();
Throwable
causeException
=
e
;
while
(
causeException
!=
null
&&
(
causeException
.
getCause
()
!=
null
||
expMessage
.
length
()
<
maxExceptionStackLength
))
{
causeException
.
printStackTrace
(
new
java
.
io
.
PrintWriter
(
buf
,
true
));
expMessage
.
append
(
buf
.
toString
());
causeException
=
causeException
.
getCause
();
}
}
finally
{
try
{
buf
.
close
();
}
catch
(
IOException
ioe
)
{
logger
.
log
(
Level
.
ALL
,
"Close exception stack input stream failed"
,
ioe
);
}
}
this
.
exceptionStack
=
expMessage
.
toString
();
if
(!
exclusiveExceptionSet
.
contains
(
e
.
getClass
().
getName
()))
{
this
.
statusCode
=
1
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录