Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
28e686ed
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 搜索 >>
提交
28e686ed
编写于
1月 26, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. 修复ExceptionStack过长不截取的问题
2. 修复Netty拆包过程中可能造成数据有问题
上级
489f143f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
20 deletion
+38
-20
skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
.../src/main/java/com/ai/cloud/skywalking/protocol/Span.java
+9
-4
skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java
...va/com/ai/cloud/skywalking/reciever/CollectionServer.java
+9
-15
skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/handler/CollectionServerDataHandler.java
...walking/reciever/handler/CollectionServerDataHandler.java
+20
-1
未找到文件。
skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
浏览文件 @
28e686ed
...
...
@@ -192,9 +192,8 @@ public class Span extends SpanData {
try
{
buf
=
new
ByteArrayOutputStream
();
Throwable
causeException
=
e
;
while
(
causeException
!=
null
&&
(
causeException
.
getCause
()
!=
null
||
expMessage
.
length
()
<
maxExceptionStackLength
))
{
while
(
expMessage
.
length
()
<
maxExceptionStackLength
&&
causeException
!=
null
&&
causeException
.
getCause
()
!=
null
)
{
causeException
.
printStackTrace
(
new
java
.
io
.
PrintWriter
(
buf
,
true
));
expMessage
.
append
(
buf
.
toString
());
...
...
@@ -209,7 +208,13 @@ public class Span extends SpanData {
"Close exception stack input stream failed"
,
ioe
);
}
}
this
.
exceptionStack
=
expMessage
.
toString
();
int
sublength
=
maxExceptionStackLength
;
if
(
maxExceptionStackLength
>
expMessage
.
length
()){
sublength
=
expMessage
.
length
();
}
this
.
exceptionStack
=
expMessage
.
toString
().
substring
(
0
,
sublength
);
if
(!
exclusiveExceptionSet
.
contains
(
e
.
getClass
().
getName
()))
{
this
.
statusCode
=
1
;
...
...
skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/CollectionServer.java
浏览文件 @
28e686ed
package
com.ai.cloud.skywalking.reciever
;
import
com.ai.cloud.skywalking.reciever.buffer.DataBufferThreadContainer
;
import
com.ai.cloud.skywalking.reciever.conf.Config
;
import
com.ai.cloud.skywalking.reciever.conf.ConfigInitializer
;
import
com.ai.cloud.skywalking.reciever.handler.CollectionServerDataHandler
;
import
com.ai.cloud.skywalking.reciever.persistance.PersistenceThreadLauncher
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.channel.ChannelFuture
;
import
io.netty.channel.ChannelInitializer
;
import
io.netty.channel.ChannelOption
;
import
io.netty.channel.ChannelPipeline
;
import
io.netty.channel.EventLoopGroup
;
import
io.netty.channel.*
;
import
io.netty.channel.nio.NioEventLoopGroup
;
import
io.netty.channel.socket.nio.NioServerSocketChannel
;
import
io.netty.handler.codec.LengthFieldBasedFrameDecoder
;
...
...
@@ -14,18 +15,11 @@ import io.netty.handler.codec.bytes.ByteArrayDecoder;
import
io.netty.handler.codec.bytes.ByteArrayEncoder
;
import
io.netty.handler.logging.LogLevel
;
import
io.netty.handler.logging.LoggingHandler
;
import
java.io.IOException
;
import
java.util.Properties
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.ai.cloud.skywalking.reciever.buffer.DataBufferThreadContainer
;
import
com.ai.cloud.skywalking.reciever.conf.Config
;
import
com.ai.cloud.skywalking.reciever.conf.ConfigInitializer
;
import
com.ai.cloud.skywalking.reciever.handler.CollectionServerDataHandler
;
import
com.ai.cloud.skywalking.reciever.persistance.PersistenceThreadLauncher
;
import
java.io.IOException
;
import
java.util.Properties
;
public
class
CollectionServer
{
...
...
@@ -49,7 +43,7 @@ public class CollectionServer {
@Override
public
void
initChannel
(
io
.
netty
.
channel
.
socket
.
SocketChannel
ch
)
throws
Exception
{
ChannelPipeline
p
=
ch
.
pipeline
();
p
.
addLast
(
"frameDecoder"
,
new
LengthFieldBasedFrameDecoder
(
Integer
.
MAX_VALUE
,
0
,
4
,
0
,
4
));
p
.
addLast
(
"frameDecoder"
,
new
LengthFieldBasedFrameDecoder
(
Integer
.
MAX_VALUE
,
0
,
4
,
0
,
0
));
p
.
addLast
(
"frameEncoder"
,
new
LengthFieldPrepender
(
4
));
p
.
addLast
(
"decoder"
,
new
ByteArrayDecoder
());
p
.
addLast
(
"encoder"
,
new
ByteArrayEncoder
());
...
...
skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/handler/CollectionServerDataHandler.java
浏览文件 @
28e686ed
...
...
@@ -12,7 +12,26 @@ public class CollectionServerDataHandler extends SimpleChannelInboundHandler<byt
Thread
.
currentThread
().
setName
(
"ServerReceiver"
);
// 当接受到这条消息的是空,则忽略
if
(
msg
!=
null
&&
msg
.
length
>=
0
&&
msg
.
length
<
Config
.
DataPackage
.
MAX_DATA_PACKAGE
)
{
DataBufferThreadContainer
.
getDataBufferThread
().
saveTemporarily
(
msg
);
int
start
=
0
;
int
end
;
while
(
start
<
msg
.
length
)
{
int
length
=
bytesToInt
(
msg
,
start
);
start
=
start
+
4
;
end
=
start
+
length
;
byte
[]
dest
=
new
byte
[
length
];
System
.
arraycopy
(
msg
,
start
,
dest
,
0
,
length
);
DataBufferThreadContainer
.
getDataBufferThread
().
saveTemporarily
(
dest
);
start
=
end
;
}
}
}
public
static
int
bytesToInt
(
byte
[]
ary
,
int
offset
)
{
int
value
;
value
=
(
int
)
((
ary
[
offset
+
3
]
&
0xFF
)
|
((
ary
[
offset
+
2
]
<<
8
)
&
0xFF00
)
|
((
ary
[
offset
+
1
]
<<
16
)
&
0xFF0000
)
|
((
ary
[
offset
]
<<
24
)
&
0xFF000000
));
return
value
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录