Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
43cbb6fa
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,发现更多精彩内容 >>
提交
43cbb6fa
编写于
2月 08, 2017
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some issues
上级
9147fec6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
119 addition
and
49 deletion
+119
-49
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/disruptor/ack/AckSpanClearEventHandler.java
...lking/routing/disruptor/ack/AckSpanClearEventHandler.java
+14
-0
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/disruptor/ack/AckSpanDisruptor.java
...ye/skywalking/routing/disruptor/ack/AckSpanDisruptor.java
+1
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/AckSpanDataHolder.java
...e/skywalking/storage/disruptor/ack/AckSpanDataHolder.java
+23
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/AckSpanFactory.java
.../eye/skywalking/storage/disruptor/ack/AckSpanFactory.java
+3
-3
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/StoreAckSpanEventHandler.java
...lking/storage/disruptor/ack/StoreAckSpanEventHandler.java
+18
-13
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/RequestSpanDataHolder.java
...king/storage/disruptor/request/RequestSpanDataHolder.java
+25
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/RequestSpanFactory.java
...walking/storage/disruptor/request/RequestSpanFactory.java
+3
-3
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/StoreRequestSpanEventHandler.java
...orage/disruptor/request/StoreRequestSpanEventHandler.java
+20
-17
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/listener/StorageListener.java
...om/a/eye/skywalking/storage/listener/StorageListener.java
+12
-12
未找到文件。
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/disruptor/ack/AckSpanClearEventHandler.java
0 → 100644
浏览文件 @
43cbb6fa
package
com.a.eye.skywalking.routing.disruptor.ack
;
import
com.lmax.disruptor.EventHandler
;
/**
* Created by xin on 2017/2/8.
*/
public
class
AckSpanClearEventHandler
implements
EventHandler
<
AckSpanHolder
>
{
@Override
public
void
onEvent
(
AckSpanHolder
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
event
.
setAckSpan
(
null
);
}
}
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/disruptor/ack/AckSpanDisruptor.java
浏览文件 @
43cbb6fa
...
...
@@ -26,7 +26,7 @@ public class AckSpanDisruptor extends AbstractSpanDisruptor {
public
AckSpanDisruptor
(
String
connectionURL
)
{
ackSpanDisruptor
=
new
Disruptor
<
AckSpanHolder
>(
new
AckSpanFactory
(),
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
ackSpanEventHandler
=
new
RouteAckSpanBufferEventHandler
(
connectionURL
);
ackSpanDisruptor
.
handleEventsWith
(
ackSpanEventHandler
,
new
SpanAlarm
Handler
());
ackSpanDisruptor
.
handleEventsWith
(
ackSpanEventHandler
).
then
(
new
SpanAlarmHandler
()).
then
(
new
AckSpanClearEvent
Handler
());
ackSpanDisruptor
.
start
();
ackSpanRingBuffer
=
ackSpanDisruptor
.
getRingBuffer
();
}
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/AckSpanDataHolder.java
0 → 100644
浏览文件 @
43cbb6fa
package
com.a.eye.skywalking.storage.disruptor.ack
;
import
com.a.eye.skywalking.network.grpc.AckSpan
;
import
com.a.eye.skywalking.storage.data.spandata.AckSpanData
;
/**
* @author zhangxin
*/
public
class
AckSpanDataHolder
{
private
AckSpanData
ackSpanData
;
public
AckSpanData
getAckSpanData
()
{
return
ackSpanData
;
}
public
void
clearData
()
{
this
.
ackSpanData
=
null
;
}
public
void
fillData
(
AckSpan
ackSpan
)
{
this
.
ackSpanData
=
new
AckSpanData
(
ackSpan
);
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/AckSpanFactory.java
浏览文件 @
43cbb6fa
...
...
@@ -6,9 +6,9 @@ import com.lmax.disruptor.EventFactory;
/**
* Created by wusheng on 2016/11/24.
*/
public
class
AckSpanFactory
implements
EventFactory
<
AckSpanData
>
{
public
class
AckSpanFactory
implements
EventFactory
<
AckSpanData
Holder
>
{
@Override
public
AckSpanData
newInstance
()
{
return
new
AckSpanData
();
public
AckSpanData
Holder
newInstance
()
{
return
new
AckSpanData
Holder
();
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/ack/StoreAckSpanEventHandler.java
浏览文件 @
43cbb6fa
...
...
@@ -11,6 +11,7 @@ import com.a.eye.skywalking.storage.data.index.IndexOperator;
import
com.a.eye.skywalking.storage.data.index.IndexOperatorFactory
;
import
com.a.eye.skywalking.storage.data.spandata.AckSpanData
;
import
com.a.eye.skywalking.storage.data.spandata.SpanData
;
import
com.a.eye.skywalking.storage.disruptor.request.RequestSpanDataHolder
;
import
com.lmax.disruptor.EventHandler
;
import
java.util.ArrayList
;
...
...
@@ -19,7 +20,7 @@ import java.util.List;
/**
* Created by wusheng on 2016/11/24.
*/
public
class
StoreAckSpanEventHandler
implements
EventHandler
<
AckSpanData
>
{
public
class
StoreAckSpanEventHandler
implements
EventHandler
<
AckSpanData
Holder
>
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
StoreAckSpanEventHandler
.
class
);
private
DataFileWriter
fileWriter
;
private
IndexOperator
operator
;
...
...
@@ -34,21 +35,25 @@ public class StoreAckSpanEventHandler implements EventHandler<AckSpanData> {
}
@Override
public
void
onEvent
(
AckSpanData
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
buffer
.
add
(
event
);
public
void
onEvent
(
AckSpanDataHolder
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
try
{
buffer
.
add
(
event
.
getAckSpanData
());
if
(
endOfBatch
||
buffer
.
size
()
==
bufferSize
)
{
try
{
IndexMetaCollection
collection
=
fileWriter
.
write
(
buffer
);
if
(
endOfBatch
||
buffer
.
size
()
==
bufferSize
)
{
try
{
IndexMetaCollection
collection
=
fileWriter
.
write
(
buffer
);
operator
.
batchUpdate
(
collection
);
HealthCollector
.
getCurrentHeathReading
(
"StoreAckSpanEventHandler"
).
updateData
(
HeathReading
.
INFO
,
"Batch consume %s messages successfully."
,
buffer
.
size
());
}
catch
(
Throwable
e
)
{
logger
.
error
(
"Ack messages consume failure."
,
e
);
HealthCollector
.
getCurrentHeathReading
(
"StoreAckSpanEventHandler"
).
updateData
(
HeathReading
.
ERROR
,
"Batch consume %s messages failure."
,
buffer
.
size
());
}
finally
{
buffer
.
clear
();
operator
.
batchUpdate
(
collection
);
HealthCollector
.
getCurrentHeathReading
(
"StoreAckSpanEventHandler"
).
updateData
(
HeathReading
.
INFO
,
"Batch consume %s messages successfully."
,
buffer
.
size
());
}
catch
(
Throwable
e
)
{
logger
.
error
(
"Ack messages consume failure."
,
e
);
HealthCollector
.
getCurrentHeathReading
(
"StoreAckSpanEventHandler"
).
updateData
(
HeathReading
.
ERROR
,
"Batch consume %s messages failure."
,
buffer
.
size
());
}
finally
{
buffer
.
clear
();
}
}
}
finally
{
event
.
clearData
();
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/RequestSpanDataHolder.java
0 → 100644
浏览文件 @
43cbb6fa
package
com.a.eye.skywalking.storage.disruptor.request
;
import
com.a.eye.skywalking.network.grpc.RequestSpan
;
import
com.a.eye.skywalking.storage.data.spandata.RequestSpanData
;
/**
* @author zhangxin
*/
public
class
RequestSpanDataHolder
{
private
RequestSpanData
requestSpanData
;
public
void
clearData
()
{
this
.
requestSpanData
=
null
;
}
public
RequestSpanData
getRequestSpanData
()
{
return
requestSpanData
;
}
public
void
fillData
(
RequestSpan
requestSpan
)
{
requestSpanData
=
new
RequestSpanData
(
requestSpan
);
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/RequestSpanFactory.java
浏览文件 @
43cbb6fa
...
...
@@ -6,9 +6,9 @@ import com.lmax.disruptor.EventFactory;
/**
* Created by wusheng on 2016/11/24.
*/
public
class
RequestSpanFactory
implements
EventFactory
<
RequestSpanData
>
{
public
class
RequestSpanFactory
implements
EventFactory
<
RequestSpanData
Holder
>
{
@Override
public
RequestSpanData
newInstance
()
{
return
new
RequestSpanData
();
public
RequestSpanData
Holder
newInstance
()
{
return
new
RequestSpanData
Holder
();
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/disruptor/request/StoreRequestSpanEventHandler.java
浏览文件 @
43cbb6fa
...
...
@@ -19,7 +19,7 @@ import java.util.List;
/**
* Created by wusheng on 2016/11/24.
*/
public
class
StoreRequestSpanEventHandler
implements
EventHandler
<
RequestSpanData
>
{
public
class
StoreRequestSpanEventHandler
implements
EventHandler
<
RequestSpanData
Holder
>
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
StoreRequestSpanEventHandler
.
class
);
private
DataFileWriter
fileWriter
;
private
IndexOperator
operator
;
...
...
@@ -34,23 +34,26 @@ public class StoreRequestSpanEventHandler implements EventHandler<RequestSpanDat
}
@Override
public
void
onEvent
(
RequestSpanData
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
buffer
.
add
(
event
);
if
(
endOfBatch
||
buffer
.
size
()
==
bufferSize
)
{
try
{
IndexMetaCollection
collection
=
fileWriter
.
write
(
buffer
);
operator
.
batchUpdate
(
collection
);
HealthCollector
.
getCurrentHeathReading
(
"StoreRequestSpanEventHandler"
).
updateData
(
HeathReading
.
INFO
,
"Batch consume %s messages successfully."
,
buffer
.
size
());
}
catch
(
Throwable
e
)
{
logger
.
error
(
"Ack messages consume failure."
,
e
);
HealthCollector
.
getCurrentHeathReading
(
"StoreRequestSpanEventHandler"
).
updateData
(
HeathReading
.
ERROR
,
"Batch consume %s messages failure."
,
buffer
.
size
());
}
finally
{
buffer
.
clear
();
public
void
onEvent
(
RequestSpanDataHolder
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
try
{
buffer
.
add
(
event
.
getRequestSpanData
());
if
(
endOfBatch
||
buffer
.
size
()
==
bufferSize
)
{
try
{
IndexMetaCollection
collection
=
fileWriter
.
write
(
buffer
);
operator
.
batchUpdate
(
collection
);
HealthCollector
.
getCurrentHeathReading
(
"StoreRequestSpanEventHandler"
).
updateData
(
HeathReading
.
INFO
,
"Batch consume %s messages successfully."
,
buffer
.
size
());
}
catch
(
Throwable
e
)
{
logger
.
error
(
"Ack messages consume failure."
,
e
);
HealthCollector
.
getCurrentHeathReading
(
"StoreRequestSpanEventHandler"
).
updateData
(
HeathReading
.
ERROR
,
"Batch consume %s messages failure."
,
buffer
.
size
());
}
finally
{
buffer
.
clear
();
}
}
}
finally
{
event
.
clearData
();
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/listener/StorageListener.java
浏览文件 @
43cbb6fa
...
...
@@ -8,10 +8,10 @@ import com.a.eye.skywalking.network.grpc.AckSpan;
import
com.a.eye.skywalking.network.grpc.RequestSpan
;
import
com.a.eye.skywalking.network.listener.server.SpanStorageServerListener
;
import
com.a.eye.skywalking.storage.config.Config
;
import
com.a.eye.skywalking.storage.data.spandata.AckSpanData
;
import
com.a.eye.skywalking.storage.data.spandata.RequestSpanData
;
import
com.a.eye.skywalking.storage.disruptor.ack.AckSpanDataHolder
;
import
com.a.eye.skywalking.storage.disruptor.ack.AckSpanFactory
;
import
com.a.eye.skywalking.storage.disruptor.ack.StoreAckSpanEventHandler
;
import
com.a.eye.skywalking.storage.disruptor.request.RequestSpanDataHolder
;
import
com.a.eye.skywalking.storage.disruptor.request.RequestSpanFactory
;
import
com.a.eye.skywalking.storage.disruptor.request.StoreRequestSpanEventHandler
;
import
com.lmax.disruptor.RingBuffer
;
...
...
@@ -22,19 +22,19 @@ public class StorageListener implements SpanStorageServerListener {
private
ILog
logger
=
LogManager
.
getLogger
(
StorageListener
.
class
);
private
Disruptor
<
RequestSpanData
>
requestSpanDisruptor
;
private
RingBuffer
<
RequestSpanData
>
requestSpanRingBuffer
;
private
Disruptor
<
RequestSpanData
Holder
>
requestSpanDisruptor
;
private
RingBuffer
<
RequestSpanData
Holder
>
requestSpanRingBuffer
;
private
Disruptor
<
AckSpanData
>
ackSpanDisruptor
;
private
RingBuffer
<
AckSpanData
>
ackSpanRingBuffer
;
private
Disruptor
<
AckSpanData
Holder
>
ackSpanDisruptor
;
private
RingBuffer
<
AckSpanData
Holder
>
ackSpanRingBuffer
;
public
StorageListener
()
{
requestSpanDisruptor
=
new
Disruptor
<
RequestSpanData
>(
new
RequestSpanFactory
(),
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
requestSpanDisruptor
=
new
Disruptor
<
RequestSpanData
Holder
>(
new
RequestSpanFactory
(),
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
requestSpanDisruptor
.
handleEventsWith
(
new
StoreRequestSpanEventHandler
());
requestSpanDisruptor
.
start
();
requestSpanRingBuffer
=
requestSpanDisruptor
.
getRingBuffer
();
ackSpanDisruptor
=
new
Disruptor
<
AckSpanData
>(
new
AckSpanFactory
(),
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
ackSpanDisruptor
=
new
Disruptor
<
AckSpanData
Holder
>(
new
AckSpanFactory
(),
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
ackSpanDisruptor
.
handleEventsWith
(
new
StoreAckSpanEventHandler
());
ackSpanDisruptor
.
start
();
ackSpanRingBuffer
=
ackSpanDisruptor
.
getRingBuffer
();
...
...
@@ -44,8 +44,8 @@ public class StorageListener implements SpanStorageServerListener {
public
boolean
storage
(
RequestSpan
requestSpan
)
{
long
sequence
=
requestSpanRingBuffer
.
next
();
// Grab the next sequence
try
{
RequestSpanData
data
=
requestSpanRingBuffer
.
get
(
sequence
);
data
.
setRequestSpan
(
requestSpan
);
RequestSpanData
Holder
data
=
requestSpanRingBuffer
.
get
(
sequence
);
data
.
fillData
(
requestSpan
);
HealthCollector
.
getCurrentHeathReading
(
"StorageListener"
).
updateData
(
HeathReading
.
INFO
,
"RequestSpan stored."
);
return
true
;
...
...
@@ -62,8 +62,8 @@ public class StorageListener implements SpanStorageServerListener {
public
boolean
storage
(
AckSpan
ackSpan
)
{
long
sequence
=
ackSpanRingBuffer
.
next
();
// Grab the next sequence
try
{
AckSpanData
data
=
ackSpanRingBuffer
.
get
(
sequence
);
data
.
setAckSpan
(
ackSpan
);
AckSpanData
Holder
data
=
ackSpanRingBuffer
.
get
(
sequence
);
data
.
fillData
(
ackSpan
);
HealthCollector
.
getCurrentHeathReading
(
"StorageListener"
).
updateData
(
HeathReading
.
INFO
,
"AckSpan stored."
);
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录