Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
7ac93aff
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
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,发现更多精彩内容 >>
提交
7ac93aff
编写于
9月 09, 2017
作者:
P
pengys5
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete the s5TimeBucket column
上级
7aac7365
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
212 addition
and
225 deletion
+212
-225
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java
...ector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java
+22
-23
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java
...apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java
+1
-1
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java
...or/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java
+1
-1
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java
...or/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java
+1
-1
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java
...g/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java
+1
-2
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java
...ctor/agentjvm/worker/gc/define/GCMetricEsTableDefine.java
+1
-2
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java
...ctor/agentjvm/worker/gc/define/GCMetricH2TableDefine.java
+1
-2
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java
...agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java
+1
-1
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java
...rker/memorypool/define/MemoryPoolMetricEsTableDefine.java
+1
-1
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java
...rker/memorypool/define/MemoryPoolMetricH2TableDefine.java
+1
-1
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java
...or/agentstream/worker/global/GlobalTraceSpanListener.java
+2
-1
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java
...ker/instance/performance/InstPerformanceSpanListener.java
+5
-6
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java
...worker/instance/performance/dao/InstPerformanceEsDAO.java
+3
-6
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java
...ance/performance/define/InstPerformanceEsTableDefine.java
+1
-2
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java
...ance/performance/define/InstPerformanceH2TableDefine.java
+1
-2
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java
...g/skywalking/apm/collector/core/util/TimeBucketUtils.java
+11
-8
apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java
...ing/apm/collector/core/utils/TimeBucketUtilsTestCase.java
+6
-8
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java
.../skywalking/apm/collector/storage/define/CommonTable.java
+0
-1
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java
...or/storage/define/instance/InstPerformanceDataDefine.java
+12
-26
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java
...llector/storage/define/instance/InstPerformanceTable.java
+1
-1
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java
...apm/collector/storage/define/jvm/CpuMetricDataDefine.java
+10
-10
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java
...king/apm/collector/storage/define/jvm/CpuMetricTable.java
+1
-1
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java
.../apm/collector/storage/define/jvm/GCMetricDataDefine.java
+11
-25
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java
...lking/apm/collector/storage/define/jvm/GCMetricTable.java
+1
-1
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java
...lector/storage/define/jvm/MemoryPoolMetricDataDefine.java
+10
-10
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java
...m/collector/storage/define/jvm/MemoryPoolMetricTable.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java
...va/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java
+4
-8
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java
...va/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java
...ava/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
.../skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
+6
-7
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java
...ava/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java
+3
-0
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
...skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
+12
-37
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
...skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
+1
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
...va/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
+30
-5
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java
...va/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java
+5
-0
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java
.../ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java
+10
-4
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
...lking/apm/collector/ui/service/InstanceHealthService.java
+29
-13
apm-network/src/main/proto/DiscoveryService.proto
apm-network/src/main/proto/DiscoveryService.proto
+3
-3
未找到文件。
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java
浏览文件 @
7ac93aff
...
...
@@ -38,29 +38,29 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JVMMetricsServiceHandler
.
class
);
@Override
public
void
collect
(
JVMMetrics
request
,
StreamObserver
<
Downstream
>
responseObserver
)
{
int
applicationI
nstanceId
=
request
.
getApplicationInstanceId
();
logger
.
debug
(
"receive the jvm metric from application instance, id: {}"
,
applicationI
nstanceId
);
int
i
nstanceId
=
request
.
getApplicationInstanceId
();
logger
.
debug
(
"receive the jvm metric from application instance, id: {}"
,
i
nstanceId
);
StreamModuleContext
context
=
(
StreamModuleContext
)
CollectorContextHelper
.
INSTANCE
.
getContext
(
StreamModuleGroupDefine
.
GROUP_NAME
);
request
.
getMetricsList
().
forEach
(
metric
->
{
long
time
=
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
metric
.
getTime
());
senToInstanceHeartBeatPersistenceWorker
(
context
,
applicationI
nstanceId
,
metric
.
getTime
());
sendToCpuMetricPersistenceWorker
(
context
,
applicationI
nstanceId
,
time
,
metric
.
getCpu
());
sendToMemoryMetricPersistenceWorker
(
context
,
applicationI
nstanceId
,
time
,
metric
.
getMemoryList
());
sendToMemoryPoolMetricPersistenceWorker
(
context
,
applicationI
nstanceId
,
time
,
metric
.
getMemoryPoolList
());
sendToGCMetricPersistenceWorker
(
context
,
applicationI
nstanceId
,
time
,
metric
.
getGcList
());
senToInstanceHeartBeatPersistenceWorker
(
context
,
i
nstanceId
,
metric
.
getTime
());
sendToCpuMetricPersistenceWorker
(
context
,
i
nstanceId
,
time
,
metric
.
getCpu
());
sendToMemoryMetricPersistenceWorker
(
context
,
i
nstanceId
,
time
,
metric
.
getMemoryList
());
sendToMemoryPoolMetricPersistenceWorker
(
context
,
i
nstanceId
,
time
,
metric
.
getMemoryPoolList
());
sendToGCMetricPersistenceWorker
(
context
,
i
nstanceId
,
time
,
metric
.
getGcList
());
});
responseObserver
.
onNext
(
Downstream
.
newBuilder
().
build
());
responseObserver
.
onCompleted
();
}
private
void
senToInstanceHeartBeatPersistenceWorker
(
StreamModuleContext
context
,
int
applicationI
nstanceId
,
private
void
senToInstanceHeartBeatPersistenceWorker
(
StreamModuleContext
context
,
int
i
nstanceId
,
long
heartBeatTime
)
{
InstanceHeartBeatDataDefine
.
InstanceHeartBeat
heartBeat
=
new
InstanceHeartBeatDataDefine
.
InstanceHeartBeat
();
heartBeat
.
setId
(
String
.
valueOf
(
applicationI
nstanceId
));
heartBeat
.
setId
(
String
.
valueOf
(
i
nstanceId
));
heartBeat
.
setHeartBeatTime
(
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
heartBeatTime
));
heartBeat
.
setInstanceId
(
applicationI
nstanceId
);
heartBeat
.
setInstanceId
(
i
nstanceId
);
try
{
logger
.
debug
(
"send to instance heart beat persistence worker, id: {}"
,
heartBeat
.
getId
());
context
.
getClusterWorkerContext
().
lookup
(
InstHeartBeatPersistenceWorker
.
WorkerRole
.
INSTANCE
).
tell
(
heartBeat
.
toData
());
...
...
@@ -69,11 +69,11 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
}
}
private
void
sendToCpuMetricPersistenceWorker
(
StreamModuleContext
context
,
int
applicationI
nstanceId
,
private
void
sendToCpuMetricPersistenceWorker
(
StreamModuleContext
context
,
int
i
nstanceId
,
long
timeBucket
,
CPU
cpu
)
{
CpuMetricDataDefine
.
CpuMetric
cpuMetric
=
new
CpuMetricDataDefine
.
CpuMetric
();
cpuMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
applicationI
nstanceId
);
cpuMetric
.
set
ApplicationInstanceId
(
applicationI
nstanceId
);
cpuMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
i
nstanceId
);
cpuMetric
.
set
InstanceId
(
i
nstanceId
);
cpuMetric
.
setUsagePercent
(
cpu
.
getUsagePercent
());
cpuMetric
.
setTimeBucket
(
timeBucket
);
try
{
...
...
@@ -84,13 +84,13 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
}
}
private
void
sendToMemoryMetricPersistenceWorker
(
StreamModuleContext
context
,
int
applicationI
nstanceId
,
private
void
sendToMemoryMetricPersistenceWorker
(
StreamModuleContext
context
,
int
i
nstanceId
,
long
timeBucket
,
List
<
Memory
>
memories
)
{
memories
.
forEach
(
memory
->
{
MemoryMetricDataDefine
.
MemoryMetric
memoryMetric
=
new
MemoryMetricDataDefine
.
MemoryMetric
();
memoryMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
applicationI
nstanceId
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
memory
.
getIsHeap
()));
memoryMetric
.
setApplicationInstanceId
(
applicationI
nstanceId
);
memoryMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
i
nstanceId
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
memory
.
getIsHeap
()));
memoryMetric
.
setApplicationInstanceId
(
i
nstanceId
);
memoryMetric
.
setHeap
(
memory
.
getIsHeap
());
memoryMetric
.
setInit
(
memory
.
getInit
());
memoryMetric
.
setMax
(
memory
.
getMax
());
...
...
@@ -106,13 +106,13 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
});
}
private
void
sendToMemoryPoolMetricPersistenceWorker
(
StreamModuleContext
context
,
int
applicationI
nstanceId
,
private
void
sendToMemoryPoolMetricPersistenceWorker
(
StreamModuleContext
context
,
int
i
nstanceId
,
long
timeBucket
,
List
<
MemoryPool
>
memoryPools
)
{
memoryPools
.
forEach
(
memoryPool
->
{
MemoryPoolMetricDataDefine
.
MemoryPoolMetric
memoryPoolMetric
=
new
MemoryPoolMetricDataDefine
.
MemoryPoolMetric
();
memoryPoolMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
applicationI
nstanceId
+
Const
.
ID_SPLIT
+
memoryPool
.
getIsHeap
()
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
memoryPool
.
getType
().
getNumber
()));
memoryPoolMetric
.
set
ApplicationInstanceId
(
applicationI
nstanceId
);
memoryPoolMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
i
nstanceId
+
Const
.
ID_SPLIT
+
memoryPool
.
getIsHeap
()
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
memoryPool
.
getType
().
getNumber
()));
memoryPoolMetric
.
set
InstanceId
(
i
nstanceId
);
memoryPoolMetric
.
setPoolType
(
memoryPool
.
getType
().
getNumber
());
memoryPoolMetric
.
setHeap
(
memoryPool
.
getIsHeap
());
memoryPoolMetric
.
setInit
(
memoryPool
.
getInit
());
...
...
@@ -129,17 +129,16 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
});
}
private
void
sendToGCMetricPersistenceWorker
(
StreamModuleContext
context
,
int
applicationI
nstanceId
,
private
void
sendToGCMetricPersistenceWorker
(
StreamModuleContext
context
,
int
i
nstanceId
,
long
timeBucket
,
List
<
GC
>
gcs
)
{
gcs
.
forEach
(
gc
->
{
GCMetricDataDefine
.
GCMetric
gcMetric
=
new
GCMetricDataDefine
.
GCMetric
();
gcMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
applicationI
nstanceId
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
gc
.
getPhraseValue
()));
gcMetric
.
set
ApplicationInstanceId
(
applicationI
nstanceId
);
gcMetric
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
i
nstanceId
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
gc
.
getPhraseValue
()));
gcMetric
.
set
InstanceId
(
i
nstanceId
);
gcMetric
.
setPhrase
(
gc
.
getPhraseValue
());
gcMetric
.
setCount
(
gc
.
getCount
());
gcMetric
.
setTime
(
gc
.
getTime
());
gcMetric
.
setTimeBucket
(
timeBucket
);
gcMetric
.
setS5TimeBucket
(
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
timeBucket
));
try
{
logger
.
debug
(
"send to gc metric persistence worker, id: {}"
,
gcMetric
.
getId
());
context
.
getClusterWorkerContext
().
lookup
(
GCMetricPersistenceWorker
.
WorkerRole
.
INSTANCE
).
tell
(
gcMetric
.
toData
());
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -25,7 +25,7 @@ public class CpuMetricEsDAO extends EsDAO implements ICpuMetricDAO, IPersistence
@Override
public
IndexRequestBuilder
prepareBatchInsert
(
Data
data
)
{
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
CpuMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
data
.
getDataDouble
(
0
));
source
.
put
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
data
.
getDataLong
(
0
));
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -26,7 +26,7 @@ public class CpuMetricEsTableDefine extends ElasticSearchTableDefine {
}
@Override
public
void
initialize
()
{
addColumn
(
new
ElasticSearchColumnDefine
(
CpuMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
ElasticSearchColumnDefine
.
Type
.
Double
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
}
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -15,7 +15,7 @@ public class CpuMetricH2TableDefine extends H2TableDefine {
@Override
public
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
H2ColumnDefine
.
Type
.
Double
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
}
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -21,12 +21,11 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO, IPersistenceDA
@Override
public
IndexRequestBuilder
prepareBatchInsert
(
Data
data
)
{
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
GCMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
GCMetricTable
.
COLUMN_INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
GCMetricTable
.
COLUMN_PHRASE
,
data
.
getDataInteger
(
1
));
source
.
put
(
GCMetricTable
.
COLUMN_COUNT
,
data
.
getDataLong
(
0
));
source
.
put
(
GCMetricTable
.
COLUMN_TIME
,
data
.
getDataLong
(
1
));
source
.
put
(
GCMetricTable
.
COLUMN_TIME_BUCKET
,
data
.
getDataLong
(
2
));
source
.
put
(
GCMetricTable
.
COLUMN_5S_TIME_BUCKET
,
data
.
getDataLong
(
3
));
return
getClient
().
prepareIndex
(
GCMetricTable
.
TABLE
,
data
.
getDataString
(
0
)).
setSource
(
source
);
}
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -26,11 +26,10 @@ public class GCMetricEsTableDefine extends ElasticSearchTableDefine {
}
@Override
public
void
initialize
()
{
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_PHRASE
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_COUNT
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_TIME
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_TIME_BUCKET
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
GCMetricTable
.
COLUMN_5S_TIME_BUCKET
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
}
}
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -15,11 +15,10 @@ public class GCMetricH2TableDefine extends H2TableDefine {
@Override
public
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_PHRASE
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_COUNT
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_TIME
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
GCMetricTable
.
COLUMN_5S_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
}
}
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -21,7 +21,7 @@ public class MemoryPoolMetricEsDAO extends EsDAO implements IMemoryPoolMetricDAO
@Override
public
IndexRequestBuilder
prepareBatchInsert
(
Data
data
)
{
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
MemoryPoolMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
MemoryPoolMetricTable
.
COLUMN_INSTANCE_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
MemoryPoolMetricTable
.
COLUMN_POOL_TYPE
,
data
.
getDataInteger
(
1
));
source
.
put
(
MemoryPoolMetricTable
.
COLUMN_IS_HEAP
,
data
.
getDataBoolean
(
0
));
source
.
put
(
MemoryPoolMetricTable
.
COLUMN_INIT
,
data
.
getDataLong
(
0
));
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -26,7 +26,7 @@ public class MemoryPoolMetricEsTableDefine extends ElasticSearchTableDefine {
}
@Override
public
void
initialize
()
{
addColumn
(
new
ElasticSearchColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_POOL_TYPE
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_IS_HEAP
,
ElasticSearchColumnDefine
.
Type
.
Boolean
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_INIT
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
...
...
apm-collector/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -15,7 +15,7 @@ public class MemoryPoolMetricH2TableDefine extends H2TableDefine {
@Override
public
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_POOL_TYPE
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_IS_HEAP
,
H2ColumnDefine
.
Type
.
Boolean
.
name
()));
addColumn
(
new
H2ColumnDefine
(
MemoryPoolMetricTable
.
COLUMN_INIT
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java
浏览文件 @
7ac93aff
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.GlobalTraceIdsListener
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
import
org.skywalking.apm.collector.storage.define.global.GlobalTraceDataDefine
;
import
org.skywalking.apm.collector.stream.StreamModuleContext
;
...
...
@@ -52,7 +53,7 @@ public class GlobalTraceSpanListener implements FirstSpanListener, GlobalTraceId
for
(
String
globalTraceId
:
globalTraceIds
)
{
GlobalTraceDataDefine
.
GlobalTrace
globalTrace
=
new
GlobalTraceDataDefine
.
GlobalTrace
();
globalTrace
.
setGlobalTraceId
(
globalTraceId
);
globalTrace
.
setId
(
segmentId
+
globalTraceId
);
globalTrace
.
setId
(
segmentId
+
Const
.
ID_SPLIT
+
globalTraceId
);
globalTrace
.
setSegmentId
(
segmentId
);
globalTrace
.
setTimeBucket
(
timeBucket
);
try
{
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java
浏览文件 @
7ac93aff
...
...
@@ -22,7 +22,7 @@ public class InstPerformanceSpanListener implements EntrySpanListener, FirstSpan
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InstPerformanceSpanListener
.
class
);
private
int
applicationId
;
private
int
applicationI
nstanceId
;
private
int
i
nstanceId
;
private
long
cost
;
private
long
timeBucket
;
...
...
@@ -33,7 +33,7 @@ public class InstPerformanceSpanListener implements EntrySpanListener, FirstSpan
@Override
public
void
parseFirst
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
this
.
applicationId
=
applicationId
;
this
.
applicationI
nstanceId
=
applicationInstanceId
;
this
.
i
nstanceId
=
applicationInstanceId
;
this
.
cost
=
spanObject
.
getEndTime
()
-
spanObject
.
getStartTime
();
timeBucket
=
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
spanObject
.
getStartTime
());
}
...
...
@@ -42,13 +42,12 @@ public class InstPerformanceSpanListener implements EntrySpanListener, FirstSpan
StreamModuleContext
context
=
(
StreamModuleContext
)
CollectorContextHelper
.
INSTANCE
.
getContext
(
StreamModuleGroupDefine
.
GROUP_NAME
);
InstPerformanceDataDefine
.
InstPerformance
instPerformance
=
new
InstPerformanceDataDefine
.
InstPerformance
();
instPerformance
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
applicationI
nstanceId
);
instPerformance
.
setId
(
timeBucket
+
Const
.
ID_SPLIT
+
i
nstanceId
);
instPerformance
.
setApplicationId
(
applicationId
);
instPerformance
.
setInstanceId
(
applicationI
nstanceId
);
instPerformance
.
setCall
Time
s
(
1
);
instPerformance
.
setInstanceId
(
i
nstanceId
);
instPerformance
.
setCalls
(
1
);
instPerformance
.
setCostTotal
(
cost
);
instPerformance
.
setTimeBucket
(
timeBucket
);
instPerformance
.
setS5TimeBucket
(
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
timeBucket
));
try
{
logger
.
debug
(
"send to instance performance persistence worker, id: {}"
,
instPerformance
.
getId
());
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -28,10 +28,9 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO,
Map
<
String
,
Object
>
source
=
getResponse
.
getSource
();
data
.
setDataInteger
(
0
,
(
Integer
)
source
.
get
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
));
data
.
setDataInteger
(
1
,
(
Integer
)
source
.
get
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
));
data
.
setDataInteger
(
2
,
(
Integer
)
source
.
get
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
));
data
.
setDataInteger
(
2
,
(
Integer
)
source
.
get
(
InstPerformanceTable
.
COLUMN_CALLS
));
data
.
setDataLong
(
0
,
((
Number
)
source
.
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
)).
longValue
());
data
.
setDataLong
(
1
,
((
Number
)
source
.
get
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
)).
longValue
());
data
.
setDataLong
(
2
,
((
Number
)
source
.
get
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
)).
longValue
());
return
data
;
}
else
{
return
null
;
...
...
@@ -42,10 +41,9 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO,
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
data
.
getDataInteger
(
1
));
source
.
put
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
,
data
.
getDataInteger
(
2
));
source
.
put
(
InstPerformanceTable
.
COLUMN_CALLS
,
data
.
getDataInteger
(
2
));
source
.
put
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
,
data
.
getDataLong
(
0
));
source
.
put
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
data
.
getDataLong
(
1
));
source
.
put
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
data
.
getDataLong
(
2
));
return
getClient
().
prepareIndex
(
InstPerformanceTable
.
TABLE
,
data
.
getDataString
(
0
)).
setSource
(
source
);
}
...
...
@@ -54,10 +52,9 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO,
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
data
.
getDataInteger
(
0
));
source
.
put
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
data
.
getDataInteger
(
1
));
source
.
put
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
,
data
.
getDataInteger
(
2
));
source
.
put
(
InstPerformanceTable
.
COLUMN_CALLS
,
data
.
getDataInteger
(
2
));
source
.
put
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
,
data
.
getDataLong
(
0
));
source
.
put
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
data
.
getDataLong
(
1
));
source
.
put
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
data
.
getDataLong
(
2
));
return
getClient
().
prepareUpdate
(
InstPerformanceTable
.
TABLE
,
data
.
getDataString
(
0
)).
setDoc
(
source
);
}
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -28,9 +28,8 @@ public class InstPerformanceEsTableDefine extends ElasticSearchTableDefine {
@Override
public
void
initialize
()
{
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_CALLS
,
ElasticSearchColumnDefine
.
Type
.
Integer
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
}
}
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java
浏览文件 @
7ac93aff
...
...
@@ -17,9 +17,8 @@ public class InstPerformanceH2TableDefine extends H2TableDefine {
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_CALLS
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java
浏览文件 @
7ac93aff
...
...
@@ -67,15 +67,18 @@ public enum TimeBucketUtils {
}
}
public
long
getFiveSecondTimeBucket
(
long
secondTimeBucket
)
{
long
mantissa
=
secondTimeBucket
%
10
;
if
(
mantissa
<
5
)
{
return
(
secondTimeBucket
/
10
)
*
10
;
}
else
if
(
mantissa
==
5
)
{
return
secondTimeBucket
;
}
else
{
return
((
secondTimeBucket
/
10
)
+
1
)
*
10
;
public
long
[]
getFiveSecondTimeBuckets
(
long
secondTimeBucket
)
{
long
timeStamp
=
changeTimeBucket2TimeStamp
(
TimeBucketType
.
SECOND
.
name
(),
secondTimeBucket
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
timeStamp
);
long
[]
timeBuckets
=
new
long
[
5
];
timeBuckets
[
0
]
=
secondTimeBucket
;
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
calendar
.
add
(
Calendar
.
SECOND
,
-
1
);
timeBuckets
[
i
+
1
]
=
getSecondTimeBucket
(
calendar
.
getTimeInMillis
());
}
return
timeBuckets
;
}
public
long
changeToUTCTimeBucket
(
long
timeBucket
)
{
...
...
apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java
浏览文件 @
7ac93aff
...
...
@@ -11,14 +11,12 @@ public class TimeBucketUtilsTestCase {
@Test
public
void
testGetFiveSecondTimeBucket
()
{
long
fiveSecondTimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
20170804224812L
);
Assert
.
assertEquals
(
20170804224810L
,
fiveSecondTimeBucket
);
fiveSecondTimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
20170804224818L
);
Assert
.
assertEquals
(
20170804224820L
,
fiveSecondTimeBucket
);
fiveSecondTimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
20170804224815L
);
Assert
.
assertEquals
(
20170804224815L
,
fiveSecondTimeBucket
);
long
[]
timeBuckets
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBuckets
(
20170804224810L
);
Assert
.
assertEquals
(
20170804224810L
,
timeBuckets
[
0
]);
Assert
.
assertEquals
(
20170804224809L
,
timeBuckets
[
1
]);
Assert
.
assertEquals
(
20170804224808L
,
timeBuckets
[
2
]);
Assert
.
assertEquals
(
20170804224807L
,
timeBuckets
[
3
]);
Assert
.
assertEquals
(
20170804224806L
,
timeBuckets
[
4
]);
}
@Test
...
...
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java
浏览文件 @
7ac93aff
...
...
@@ -8,5 +8,4 @@ public class CommonTable {
public
static
final
String
COLUMN_ID
=
"id"
;
public
static
final
String
COLUMN_AGG
=
"agg"
;
public
static
final
String
COLUMN_TIME_BUCKET
=
"time_bucket"
;
public
static
final
String
COLUMN_5S_TIME_BUCKET
=
"s5_time_bucket"
;
}
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java
浏览文件 @
7ac93aff
...
...
@@ -16,17 +16,16 @@ import org.skywalking.apm.collector.storage.define.DataDefine;
public
class
InstPerformanceDataDefine
extends
DataDefine
{
@Override
protected
int
initialCapacity
()
{
return
7
;
return
6
;
}
@Override
protected
void
attributeDefine
()
{
addAttribute
(
0
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_ID
,
AttributeType
.
STRING
,
new
NonOperation
()));
addAttribute
(
1
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
2
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
3
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
,
AttributeType
.
INTEGER
,
new
AddOperation
()));
addAttribute
(
3
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_CALLS
,
AttributeType
.
INTEGER
,
new
AddOperation
()));
addAttribute
(
4
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
,
AttributeType
.
LONG
,
new
AddOperation
()));
addAttribute
(
5
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
AttributeType
.
LONG
,
new
CoverOperation
()));
addAttribute
(
6
,
new
Attribute
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
AttributeType
.
LONG
,
new
CoverOperation
()));
}
@Override
public
Object
deserialize
(
RemoteData
remoteData
)
{
...
...
@@ -41,21 +40,18 @@ public class InstPerformanceDataDefine extends DataDefine {
private
String
id
;
private
int
applicationId
;
private
int
instanceId
;
private
int
call
Time
s
;
private
int
calls
;
private
long
costTotal
;
private
long
timeBucket
;
private
long
s5TimeBucket
;
public
InstPerformance
(
String
id
,
int
applicationId
,
int
instanceId
,
int
callTimes
,
long
costTotal
,
long
timeBucket
,
long
s5TimeBucket
)
{
public
InstPerformance
(
String
id
,
int
applicationId
,
int
instanceId
,
int
calls
,
long
costTotal
,
long
timeBucket
)
{
this
.
id
=
id
;
this
.
applicationId
=
applicationId
;
this
.
instanceId
=
instanceId
;
this
.
call
Times
=
callTime
s
;
this
.
call
s
=
call
s
;
this
.
costTotal
=
costTotal
;
this
.
timeBucket
=
timeBucket
;
this
.
s5TimeBucket
=
s5TimeBucket
;
}
public
InstPerformance
()
{
...
...
@@ -67,10 +63,9 @@ public class InstPerformanceDataDefine extends DataDefine {
data
.
setDataString
(
0
,
this
.
id
);
data
.
setDataInteger
(
0
,
this
.
applicationId
);
data
.
setDataInteger
(
1
,
this
.
instanceId
);
data
.
setDataInteger
(
2
,
this
.
call
Time
s
);
data
.
setDataInteger
(
2
,
this
.
calls
);
data
.
setDataLong
(
0
,
this
.
costTotal
);
data
.
setDataLong
(
1
,
this
.
timeBucket
);
data
.
setDataLong
(
2
,
this
.
s5TimeBucket
);
return
data
;
}
...
...
@@ -78,10 +73,9 @@ public class InstPerformanceDataDefine extends DataDefine {
this
.
id
=
data
.
getDataString
(
0
);
this
.
applicationId
=
data
.
getDataInteger
(
0
);
this
.
instanceId
=
data
.
getDataInteger
(
1
);
this
.
call
Time
s
=
data
.
getDataInteger
(
2
);
this
.
calls
=
data
.
getDataInteger
(
2
);
this
.
costTotal
=
data
.
getDataLong
(
0
);
this
.
timeBucket
=
data
.
getDataLong
(
1
);
this
.
s5TimeBucket
=
data
.
getDataLong
(
2
);
return
this
;
}
...
...
@@ -101,12 +95,12 @@ public class InstPerformanceDataDefine extends DataDefine {
this
.
instanceId
=
instanceId
;
}
public
int
getCall
Time
s
()
{
return
call
Time
s
;
public
int
getCalls
()
{
return
calls
;
}
public
void
setCall
Times
(
int
callTime
s
)
{
this
.
call
Times
=
callTime
s
;
public
void
setCall
s
(
int
call
s
)
{
this
.
call
s
=
call
s
;
}
public
long
getCostTotal
()
{
...
...
@@ -132,13 +126,5 @@ public class InstPerformanceDataDefine extends DataDefine {
public
void
setApplicationId
(
int
applicationId
)
{
this
.
applicationId
=
applicationId
;
}
public
long
getS5TimeBucket
()
{
return
s5TimeBucket
;
}
public
void
setS5TimeBucket
(
long
s5TimeBucket
)
{
this
.
s5TimeBucket
=
s5TimeBucket
;
}
}
}
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java
浏览文件 @
7ac93aff
...
...
@@ -9,6 +9,6 @@ public class InstPerformanceTable extends CommonTable {
public
static
final
String
TABLE
=
"instance_performance"
;
public
static
final
String
COLUMN_APPLICATION_ID
=
"application_id"
;
public
static
final
String
COLUMN_INSTANCE_ID
=
"instance_id"
;
public
static
final
String
COLUMN_CALL
_TIMES
=
"call_time
s"
;
public
static
final
String
COLUMN_CALL
S
=
"call
s"
;
public
static
final
String
COLUMN_COST_TOTAL
=
"cost_total"
;
}
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java
浏览文件 @
7ac93aff
...
...
@@ -21,7 +21,7 @@ public class CpuMetricDataDefine extends DataDefine {
@Override
protected
void
attributeDefine
()
{
addAttribute
(
0
,
new
Attribute
(
CpuMetricTable
.
COLUMN_ID
,
AttributeType
.
STRING
,
new
NonOperation
()));
addAttribute
(
1
,
new
Attribute
(
CpuMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
1
,
new
Attribute
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
2
,
new
Attribute
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
AttributeType
.
DOUBLE
,
new
CoverOperation
()));
addAttribute
(
3
,
new
Attribute
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
AttributeType
.
LONG
,
new
CoverOperation
()));
}
...
...
@@ -36,13 +36,13 @@ public class CpuMetricDataDefine extends DataDefine {
public
static
class
CpuMetric
implements
Transform
<
CpuMetric
>
{
private
String
id
;
private
int
applicationI
nstanceId
;
private
int
i
nstanceId
;
private
double
usagePercent
;
private
long
timeBucket
;
public
CpuMetric
(
String
id
,
int
applicationI
nstanceId
,
double
usagePercent
,
long
timeBucket
)
{
public
CpuMetric
(
String
id
,
int
i
nstanceId
,
double
usagePercent
,
long
timeBucket
)
{
this
.
id
=
id
;
this
.
applicationInstanceId
=
applicationI
nstanceId
;
this
.
instanceId
=
i
nstanceId
;
this
.
usagePercent
=
usagePercent
;
this
.
timeBucket
=
timeBucket
;
}
...
...
@@ -54,7 +54,7 @@ public class CpuMetricDataDefine extends DataDefine {
CpuMetricDataDefine
define
=
new
CpuMetricDataDefine
();
Data
data
=
define
.
build
(
id
);
data
.
setDataString
(
0
,
this
.
id
);
data
.
setDataInteger
(
0
,
this
.
applicationI
nstanceId
);
data
.
setDataInteger
(
0
,
this
.
i
nstanceId
);
data
.
setDataDouble
(
0
,
this
.
usagePercent
);
data
.
setDataLong
(
0
,
this
.
timeBucket
);
return
data
;
...
...
@@ -62,7 +62,7 @@ public class CpuMetricDataDefine extends DataDefine {
@Override
public
CpuMetric
toSelf
(
Data
data
)
{
this
.
id
=
data
.
getDataString
(
0
);
this
.
applicationI
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
i
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
usagePercent
=
data
.
getDataDouble
(
0
);
this
.
timeBucket
=
data
.
getDataLong
(
0
);
return
this
;
...
...
@@ -72,8 +72,8 @@ public class CpuMetricDataDefine extends DataDefine {
this
.
id
=
id
;
}
public
void
set
ApplicationInstanceId
(
int
applicationI
nstanceId
)
{
this
.
applicationInstanceId
=
applicationI
nstanceId
;
public
void
set
InstanceId
(
int
i
nstanceId
)
{
this
.
instanceId
=
i
nstanceId
;
}
public
void
setUsagePercent
(
double
usagePercent
)
{
...
...
@@ -88,8 +88,8 @@ public class CpuMetricDataDefine extends DataDefine {
return
id
;
}
public
int
get
Application
InstanceId
()
{
return
applicationI
nstanceId
;
public
int
getInstanceId
()
{
return
i
nstanceId
;
}
public
double
getUsagePercent
()
{
...
...
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java
浏览文件 @
7ac93aff
...
...
@@ -7,6 +7,6 @@ import org.skywalking.apm.collector.storage.define.CommonTable;
*/
public
class
CpuMetricTable
extends
CommonTable
{
public
static
final
String
TABLE
=
"cpu_metric"
;
public
static
final
String
COLUMN_
APPLICATION_INSTANCE_ID
=
"application_
instance_id"
;
public
static
final
String
COLUMN_
INSTANCE_ID
=
"
instance_id"
;
public
static
final
String
COLUMN_USAGE_PERCENT
=
"usage_percent"
;
}
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java
浏览文件 @
7ac93aff
...
...
@@ -16,17 +16,16 @@ import org.skywalking.apm.collector.storage.define.DataDefine;
public
class
GCMetricDataDefine
extends
DataDefine
{
@Override
protected
int
initialCapacity
()
{
return
7
;
return
6
;
}
@Override
protected
void
attributeDefine
()
{
addAttribute
(
0
,
new
Attribute
(
GCMetricTable
.
COLUMN_ID
,
AttributeType
.
STRING
,
new
NonOperation
()));
addAttribute
(
1
,
new
Attribute
(
GCMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
1
,
new
Attribute
(
GCMetricTable
.
COLUMN_INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
2
,
new
Attribute
(
GCMetricTable
.
COLUMN_PHRASE
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
3
,
new
Attribute
(
GCMetricTable
.
COLUMN_COUNT
,
AttributeType
.
LONG
,
new
CoverOperation
()));
addAttribute
(
4
,
new
Attribute
(
GCMetricTable
.
COLUMN_TIME
,
AttributeType
.
LONG
,
new
CoverOperation
()));
addAttribute
(
5
,
new
Attribute
(
GCMetricTable
.
COLUMN_TIME_BUCKET
,
AttributeType
.
LONG
,
new
CoverOperation
()));
addAttribute
(
6
,
new
Attribute
(
GCMetricTable
.
COLUMN_5S_TIME_BUCKET
,
AttributeType
.
LONG
,
new
CoverOperation
()));
}
@Override
public
Object
deserialize
(
RemoteData
remoteData
)
{
...
...
@@ -39,22 +38,19 @@ public class GCMetricDataDefine extends DataDefine {
public
static
class
GCMetric
implements
Transform
<
GCMetric
>
{
private
String
id
;
private
int
applicationI
nstanceId
;
private
int
i
nstanceId
;
private
int
phrase
;
private
long
count
;
private
long
time
;
private
long
timeBucket
;
private
long
s5TimeBucket
;
public
GCMetric
(
String
id
,
int
applicationInstanceId
,
int
phrase
,
long
count
,
long
time
,
long
timeBucket
,
long
s5TimeBucket
)
{
public
GCMetric
(
String
id
,
int
instanceId
,
int
phrase
,
long
count
,
long
time
,
long
timeBucket
)
{
this
.
id
=
id
;
this
.
applicationInstanceId
=
applicationI
nstanceId
;
this
.
instanceId
=
i
nstanceId
;
this
.
phrase
=
phrase
;
this
.
count
=
count
;
this
.
time
=
time
;
this
.
timeBucket
=
timeBucket
;
this
.
s5TimeBucket
=
s5TimeBucket
;
}
public
GCMetric
()
{
...
...
@@ -64,23 +60,21 @@ public class GCMetricDataDefine extends DataDefine {
GCMetricDataDefine
define
=
new
GCMetricDataDefine
();
Data
data
=
define
.
build
(
id
);
data
.
setDataString
(
0
,
this
.
id
);
data
.
setDataInteger
(
0
,
this
.
applicationI
nstanceId
);
data
.
setDataInteger
(
0
,
this
.
i
nstanceId
);
data
.
setDataInteger
(
1
,
this
.
phrase
);
data
.
setDataLong
(
0
,
this
.
count
);
data
.
setDataLong
(
1
,
this
.
time
);
data
.
setDataLong
(
2
,
this
.
timeBucket
);
data
.
setDataLong
(
3
,
this
.
s5TimeBucket
);
return
data
;
}
@Override
public
GCMetric
toSelf
(
Data
data
)
{
this
.
id
=
data
.
getDataString
(
0
);
this
.
applicationI
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
i
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
phrase
=
data
.
getDataInteger
(
1
);
this
.
count
=
data
.
getDataLong
(
0
);
this
.
time
=
data
.
getDataLong
(
1
);
this
.
timeBucket
=
data
.
getDataLong
(
2
);
this
.
s5TimeBucket
=
data
.
getDataLong
(
3
);
return
this
;
}
...
...
@@ -88,8 +82,8 @@ public class GCMetricDataDefine extends DataDefine {
this
.
id
=
id
;
}
public
void
set
ApplicationInstanceId
(
int
applicationI
nstanceId
)
{
this
.
applicationInstanceId
=
applicationI
nstanceId
;
public
void
set
InstanceId
(
int
i
nstanceId
)
{
this
.
instanceId
=
i
nstanceId
;
}
public
void
setTimeBucket
(
long
timeBucket
)
{
...
...
@@ -100,8 +94,8 @@ public class GCMetricDataDefine extends DataDefine {
return
id
;
}
public
int
get
Application
InstanceId
()
{
return
applicationI
nstanceId
;
public
int
getInstanceId
()
{
return
i
nstanceId
;
}
public
long
getTimeBucket
()
{
...
...
@@ -131,13 +125,5 @@ public class GCMetricDataDefine extends DataDefine {
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
long
getS5TimeBucket
()
{
return
s5TimeBucket
;
}
public
void
setS5TimeBucket
(
long
s5TimeBucket
)
{
this
.
s5TimeBucket
=
s5TimeBucket
;
}
}
}
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java
浏览文件 @
7ac93aff
...
...
@@ -7,7 +7,7 @@ import org.skywalking.apm.collector.storage.define.CommonTable;
*/
public
class
GCMetricTable
extends
CommonTable
{
public
static
final
String
TABLE
=
"gc_metric"
;
public
static
final
String
COLUMN_
APPLICATION_INSTANCE_ID
=
"application_
instance_id"
;
public
static
final
String
COLUMN_
INSTANCE_ID
=
"
instance_id"
;
public
static
final
String
COLUMN_PHRASE
=
"phrase"
;
public
static
final
String
COLUMN_COUNT
=
"count"
;
public
static
final
String
COLUMN_TIME
=
"time"
;
...
...
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java
浏览文件 @
7ac93aff
...
...
@@ -21,7 +21,7 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
@Override
protected
void
attributeDefine
()
{
addAttribute
(
0
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_ID
,
AttributeType
.
STRING
,
new
NonOperation
()));
addAttribute
(
1
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_
APPLICATION_
INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
1
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_INSTANCE_ID
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
2
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_POOL_TYPE
,
AttributeType
.
INTEGER
,
new
CoverOperation
()));
addAttribute
(
3
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_IS_HEAP
,
AttributeType
.
BOOLEAN
,
new
CoverOperation
()));
addAttribute
(
4
,
new
Attribute
(
MemoryPoolMetricTable
.
COLUMN_INIT
,
AttributeType
.
LONG
,
new
CoverOperation
()));
...
...
@@ -41,7 +41,7 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
public
static
class
MemoryPoolMetric
implements
Transform
<
MemoryPoolMetric
>
{
private
String
id
;
private
int
applicationI
nstanceId
;
private
int
i
nstanceId
;
private
int
poolType
;
private
boolean
isHeap
;
private
long
init
;
...
...
@@ -50,10 +50,10 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
private
long
committed
;
private
long
timeBucket
;
public
MemoryPoolMetric
(
String
id
,
int
applicationI
nstanceId
,
int
poolType
,
boolean
isHeap
,
long
init
,
long
max
,
public
MemoryPoolMetric
(
String
id
,
int
i
nstanceId
,
int
poolType
,
boolean
isHeap
,
long
init
,
long
max
,
long
used
,
long
committed
,
long
timeBucket
)
{
this
.
id
=
id
;
this
.
applicationInstanceId
=
applicationI
nstanceId
;
this
.
instanceId
=
i
nstanceId
;
this
.
poolType
=
poolType
;
this
.
isHeap
=
isHeap
;
this
.
init
=
init
;
...
...
@@ -70,7 +70,7 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
MemoryPoolMetricDataDefine
define
=
new
MemoryPoolMetricDataDefine
();
Data
data
=
define
.
build
(
id
);
data
.
setDataString
(
0
,
this
.
id
);
data
.
setDataInteger
(
0
,
this
.
applicationI
nstanceId
);
data
.
setDataInteger
(
0
,
this
.
i
nstanceId
);
data
.
setDataInteger
(
1
,
this
.
poolType
);
data
.
setDataBoolean
(
0
,
this
.
isHeap
);
data
.
setDataLong
(
0
,
this
.
init
);
...
...
@@ -83,7 +83,7 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
@Override
public
MemoryPoolMetric
toSelf
(
Data
data
)
{
this
.
id
=
data
.
getDataString
(
0
);
this
.
applicationI
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
i
nstanceId
=
data
.
getDataInteger
(
0
);
this
.
poolType
=
data
.
getDataInteger
(
1
);
this
.
isHeap
=
data
.
getDataBoolean
(
0
);
this
.
init
=
data
.
getDataLong
(
0
);
...
...
@@ -98,8 +98,8 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
this
.
id
=
id
;
}
public
void
set
ApplicationInstanceId
(
int
applicationI
nstanceId
)
{
this
.
applicationInstanceId
=
applicationI
nstanceId
;
public
void
set
InstanceId
(
int
i
nstanceId
)
{
this
.
instanceId
=
i
nstanceId
;
}
public
void
setPoolType
(
int
poolType
)
{
...
...
@@ -134,8 +134,8 @@ public class MemoryPoolMetricDataDefine extends DataDefine {
return
id
;
}
public
int
get
Application
InstanceId
()
{
return
applicationI
nstanceId
;
public
int
getInstanceId
()
{
return
i
nstanceId
;
}
public
long
getTimeBucket
()
{
...
...
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java
浏览文件 @
7ac93aff
...
...
@@ -7,7 +7,7 @@ import org.skywalking.apm.collector.storage.define.CommonTable;
*/
public
class
MemoryPoolMetricTable
extends
CommonTable
{
public
static
final
String
TABLE
=
"memory_pool_metric"
;
public
static
final
String
COLUMN_
APPLICATION_INSTANCE_ID
=
"application_
instance_id"
;
public
static
final
String
COLUMN_
INSTANCE_ID
=
"
instance_id"
;
public
static
final
String
COLUMN_POOL_TYPE
=
"pool_type"
;
public
static
final
String
COLUMN_IS_HEAP
=
"is_heap"
;
public
static
final
String
COLUMN_INIT
=
"init"
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -10,7 +10,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
...
...
@@ -30,18 +29,15 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GCMetricEsDAO
.
class
);
@Override
public
GCCount
getGCCount
(
long
s5TimeBucket
,
int
instanceId
)
{
logger
.
debug
(
"get gc count,
s5TimeBucket: {}, instanceId: {}"
,
s5TimeBucket
,
instanceId
);
@Override
public
GCCount
getGCCount
(
long
[]
timeBuckets
,
int
instanceId
)
{
logger
.
debug
(
"get gc count,
timeBuckets: {}, instanceId: {}"
,
timeBuckets
,
instanceId
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
GCMetricTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
GCMetricTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
MatchQueryBuilder
matchApplicationId
=
QueryBuilders
.
matchQuery
(
GCMetricTable
.
COLUMN_APPLICATION_INSTANCE_ID
,
instanceId
);
MatchQueryBuilder
matchTimeBucket
=
QueryBuilders
.
matchQuery
(
GCMetricTable
.
COLUMN_5S_TIME_BUCKET
,
s5TimeBucket
);
boolQuery
.
must
().
add
(
matchApplicationId
);
boolQuery
.
must
().
add
(
matchTimeBucket
);
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
GCMetricTable
.
COLUMN_INSTANCE_ID
,
instanceId
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termsQuery
(
GCMetricTable
.
COLUMN_TIME_BUCKET
,
timeBuckets
));
searchRequestBuilder
.
setQuery
(
boolQuery
);
searchRequestBuilder
.
setSize
(
0
);
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java
浏览文件 @
7ac93aff
...
...
@@ -8,7 +8,7 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
GCMetricH2DAO
extends
H2DAO
implements
IGCMetricDAO
{
@Override
public
GCCount
getGCCount
(
long
timestamp
,
int
instanceId
)
{
@Override
public
GCCount
getGCCount
(
long
[]
timeBuckets
,
int
instanceId
)
{
return
null
;
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java
浏览文件 @
7ac93aff
...
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonObject;
*/
public
interface
IGCMetricDAO
{
GCCount
getGCCount
(
long
timestamp
,
int
instanceId
);
GCCount
getGCCount
(
long
[]
timeBuckets
,
int
instanceId
);
JsonObject
getMetric
(
int
instanceId
,
long
timeBucket
);
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
浏览文件 @
7ac93aff
package
org.skywalking.apm.collector.ui.dao
;
import
com.google.gson.JsonArray
;
import
java.util.List
;
/**
* @author pengys5
*/
public
interface
IInstPerformanceDAO
{
List
<
InstPerformance
>
getMultiple
(
long
timeBucket
,
int
application
Id
);
InstPerformance
get
(
long
[]
timeBuckets
,
int
instance
Id
);
int
getTpsMetric
(
int
instanceId
,
long
timeBucket
);
...
...
@@ -19,12 +18,12 @@ public interface IInstPerformanceDAO {
class
InstPerformance
{
private
final
int
instanceId
;
private
final
int
call
Time
s
;
private
final
int
calls
;
private
final
long
costTotal
;
public
InstPerformance
(
int
instanceId
,
int
call
Time
s
,
long
costTotal
)
{
public
InstPerformance
(
int
instanceId
,
int
calls
,
long
costTotal
)
{
this
.
instanceId
=
instanceId
;
this
.
call
Times
=
callTime
s
;
this
.
call
s
=
call
s
;
this
.
costTotal
=
costTotal
;
}
...
...
@@ -32,8 +31,8 @@ public interface IInstPerformanceDAO {
return
instanceId
;
}
public
int
getCall
Time
s
()
{
return
call
Time
s
;
public
int
getCalls
()
{
return
calls
;
}
public
long
getCostTotal
()
{
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java
浏览文件 @
7ac93aff
package
org.skywalking.apm.collector.ui.dao
;
import
com.google.gson.JsonArray
;
import
java.util.List
;
import
org.skywalking.apm.collector.storage.define.register.InstanceDataDefine
;
/**
...
...
@@ -15,6 +16,8 @@ public interface IInstanceDAO {
InstanceDataDefine
.
Instance
getInstance
(
int
instanceId
);
List
<
InstanceDataDefine
.
Instance
>
getInstances
(
int
applicationId
,
long
timeBucket
);
class
Application
{
private
final
int
applicationId
;
private
final
long
count
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
浏览文件 @
7ac93aff
package
org.skywalking.apm.collector.ui.dao
;
import
com.google.gson.JsonArray
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.elasticsearch.action.get.MultiGetItemResponse
;
import
org.elasticsearch.action.get.MultiGetRequestBuilder
;
...
...
@@ -11,10 +9,8 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.metrics.sum.Sum
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
...
...
@@ -26,46 +22,25 @@ import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO;
*/
public
class
InstPerformanceEsDAO
extends
EsDAO
implements
IInstPerformanceDAO
{
@Override
public
List
<
InstPerformance
>
getMultiple
(
long
timeBucket
,
int
application
Id
)
{
@Override
public
InstPerformance
get
(
long
[]
timeBuckets
,
int
instance
Id
)
{
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
InstPerformanceTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
InstPerformanceTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
MatchQueryBuilder
matchApplicationId
=
QueryBuilders
.
matchQuery
(
InstPerformanceTable
.
COLUMN_APPLICATION_ID
,
applicationId
);
MatchQueryBuilder
matchTimeBucket
=
QueryBuilders
.
matchQuery
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
,
timeBucket
);
boolQuery
.
must
().
add
(
matchApplicationId
);
boolQuery
.
must
().
add
(
matchTimeBucket
);
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
,
instanceId
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termsQuery
(
InstPerformanceTable
.
COLUMN_TIME_BUCKET
,
timeBuckets
));
searchRequestBuilder
.
setQuery
(
boolQuery
);
searchRequestBuilder
.
setSize
(
0
);
searchRequestBuilder
.
addAggregation
(
AggregationBuilders
.
terms
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
).
field
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
)
.
subAggregation
(
AggregationBuilders
.
terms
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
).
field
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
)
.
subAggregation
(
AggregationBuilders
.
sum
(
InstPerformanceTable
.
COLUMN_CALL_TIMES
).
field
(
InstPerformanceTable
.
COLUMN_CALL_TIMES
))
.
subAggregation
(
AggregationBuilders
.
sum
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
).
field
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
))));
searchRequestBuilder
.
addAggregation
(
AggregationBuilders
.
sum
(
InstPerformanceTable
.
COLUMN_CALLS
).
field
(
InstPerformanceTable
.
COLUMN_CALLS
));
searchRequestBuilder
.
addAggregation
(
AggregationBuilders
.
sum
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
).
field
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
));
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
Terms
instanceTerms
=
searchResponse
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_INSTANCE_ID
);
List
<
InstPerformance
>
instPerformances
=
new
LinkedList
<>();
for
(
Terms
.
Bucket
instanceBucket
:
instanceTerms
.
getBuckets
())
{
int
instanceId
=
instanceBucket
.
getKeyAsNumber
().
intValue
();
Terms
timeBucketTerms
=
instanceBucket
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_5S_TIME_BUCKET
);
for
(
Terms
.
Bucket
timeBucketBucket
:
timeBucketTerms
.
getBuckets
())
{
long
count
=
timeBucketBucket
.
getDocCount
();
Sum
sumCallTimes
=
timeBucketBucket
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_CALL_TIMES
);
Sum
sumCostTotal
=
timeBucketBucket
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
);
int
avgCallTimes
=
(
int
)(
sumCallTimes
.
getValue
()
/
count
);
int
avgCost
=
(
int
)(
sumCostTotal
.
getValue
()
/
count
);
instPerformances
.
add
(
new
InstPerformance
(
instanceId
,
avgCallTimes
,
avgCost
));
}
}
return
instPerformances
;
Sum
sumCalls
=
searchResponse
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
);
Sum
sumCostTotal
=
searchResponse
.
getAggregations
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
);
return
new
InstPerformance
(
instanceId
,
(
int
)
sumCalls
.
getValue
(),
(
long
)
sumCostTotal
.
getValue
());
}
@Override
public
int
getTpsMetric
(
int
instanceId
,
long
timeBucket
)
{
...
...
@@ -73,7 +48,7 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
GetResponse
getResponse
=
getClient
().
prepareGet
(
InstPerformanceTable
.
TABLE
,
id
).
get
();
if
(
getResponse
.
isExists
())
{
return
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
)).
intValue
();
return
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
)).
intValue
();
}
return
0
;
}
...
...
@@ -93,7 +68,7 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
metrics
.
add
(((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
)).
intValue
());
metrics
.
add
(((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
)).
intValue
());
}
else
{
metrics
.
add
(
0
);
}
...
...
@@ -106,7 +81,7 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
GetResponse
getResponse
=
getClient
().
prepareGet
(
InstPerformanceTable
.
TABLE
,
id
).
get
();
if
(
getResponse
.
isExists
())
{
int
callTimes
=
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
)).
intValue
();
int
callTimes
=
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
)).
intValue
();
int
costTotal
=
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
)).
intValue
();
return
costTotal
/
callTimes
;
}
...
...
@@ -130,7 +105,7 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
int
callTimes
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL
_TIME
S
)).
intValue
();
int
callTimes
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALLS
)).
intValue
();
int
costTotal
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
)).
intValue
();
metrics
.
add
(
costTotal
/
callTimes
);
}
else
{
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
浏览文件 @
7ac93aff
package
org.skywalking.apm.collector.ui.dao
;
import
com.google.gson.JsonArray
;
import
java.util.List
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
/**
...
...
@@ -9,7 +8,7 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
InstPerformanceH2DAO
extends
H2DAO
implements
IInstPerformanceDAO
{
@Override
public
List
<
InstPerformance
>
getMultiple
(
long
timestamp
,
int
application
Id
)
{
@Override
public
InstPerformance
get
(
long
[]
timeBuckets
,
int
instance
Id
)
{
return
null
;
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
浏览文件 @
7ac93aff
...
...
@@ -2,6 +2,8 @@ package org.skywalking.apm.collector.ui.dao;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.elasticsearch.action.get.GetRequestBuilder
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.elasticsearch.action.search.SearchRequestBuilder
;
...
...
@@ -9,7 +11,6 @@ import org.elasticsearch.action.search.SearchResponse;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.index.query.AbstractQueryBuilder
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.RangeQueryBuilder
;
import
org.elasticsearch.search.SearchHit
;
...
...
@@ -45,10 +46,8 @@ public class InstanceEsDAO extends EsDAO implements IInstanceDAO {
fiveMinuteBefore
=
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
fiveMinuteBefore
);
BoolQueryBuilder
boolQueryBuilder
=
new
BoolQueryBuilder
();
RangeQueryBuilder
rangeQueryBuilder
=
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gt
(
fiveMinuteBefore
);
MatchQueryBuilder
matchQueryBuilder
=
QueryBuilders
.
matchQuery
(
InstanceTable
.
COLUMN_INSTANCE_ID
,
applicationInstanceId
);
boolQueryBuilder
.
must
(
rangeQueryBuilder
);
boolQueryBuilder
.
must
(
matchQueryBuilder
);
boolQueryBuilder
.
must
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gt
(
fiveMinuteBefore
));
boolQueryBuilder
.
must
(
QueryBuilders
.
termQuery
(
InstanceTable
.
COLUMN_INSTANCE_ID
,
applicationInstanceId
));
return
heartBeatTime
(
boolQueryBuilder
);
}
...
...
@@ -118,4 +117,30 @@ public class InstanceEsDAO extends EsDAO implements IInstanceDAO {
}
return
null
;
}
@Override
public
List
<
InstanceDataDefine
.
Instance
>
getInstances
(
int
applicationId
,
long
timeBucket
)
{
logger
.
debug
(
"get instances info, application id: {}, timeBucket: {}"
,
applicationId
,
timeBucket
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
InstanceTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
InstanceTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
searchRequestBuilder
.
setSize
(
1000
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gte
(
timeBucket
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstanceTable
.
COLUMN_APPLICATION_ID
,
applicationId
));
searchRequestBuilder
.
setQuery
(
boolQuery
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
SearchHit
[]
searchHits
=
searchResponse
.
getHits
().
getHits
();
List
<
InstanceDataDefine
.
Instance
>
instanceList
=
new
LinkedList
<>();
for
(
SearchHit
searchHit
:
searchHits
)
{
InstanceDataDefine
.
Instance
instance
=
new
InstanceDataDefine
.
Instance
();
instance
.
setApplicationId
(((
Number
)
searchHit
.
getSource
().
get
(
InstanceTable
.
COLUMN_APPLICATION_ID
)).
intValue
());
instance
.
setHeartBeatTime
(((
Number
)
searchHit
.
getSource
().
get
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
)).
longValue
());
instance
.
setInstanceId
(((
Number
)
searchHit
.
getSource
().
get
(
InstanceTable
.
COLUMN_INSTANCE_ID
)).
intValue
());
instanceList
.
add
(
instance
);
}
return
instanceList
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java
浏览文件 @
7ac93aff
package
org.skywalking.apm.collector.ui.dao
;
import
com.google.gson.JsonArray
;
import
java.util.List
;
import
org.skywalking.apm.collector.storage.define.register.InstanceDataDefine
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
...
...
@@ -23,4 +24,8 @@ public class InstanceH2DAO extends H2DAO implements IInstanceDAO {
@Override
public
InstanceDataDefine
.
Instance
getInstance
(
int
instanceId
)
{
return
null
;
}
@Override
public
List
<
InstanceDataDefine
.
Instance
>
getInstances
(
int
applicationId
,
long
timeBucket
)
{
return
null
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java
浏览文件 @
7ac93aff
...
...
@@ -28,12 +28,18 @@ public class AllInstanceLastTimeGetHandler extends JettyHandler {
Long
timeBucket
=
service
.
allInstanceLastTime
();
logger
.
debug
(
"all instance last time: {}"
,
timeBucket
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
TimeBucketUtils
.
INSTANCE
.
changeTimeBucket2TimeStamp
(
TimeBucketUtils
.
TimeBucketType
.
SECOND
.
name
(),
timeBucket
));
calendar
.
add
(
Calendar
.
SECOND
,
-
5
);
long
instanceTimeBucket
;
if
(
timeBucket
==
0
)
{
instanceTimeBucket
=
0
;
}
else
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
TimeBucketUtils
.
INSTANCE
.
changeTimeBucket2TimeStamp
(
TimeBucketUtils
.
TimeBucketType
.
SECOND
.
name
(),
timeBucket
));
calendar
.
add
(
Calendar
.
SECOND
,
-
5
);
instanceTimeBucket
=
calendar
.
getTimeInMillis
();
}
JsonObject
timeJson
=
new
JsonObject
();
timeJson
.
addProperty
(
"timeBucket"
,
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
calendar
.
getTimeInMillis
()
));
timeJson
.
addProperty
(
"timeBucket"
,
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
instanceTimeBucket
));
return
timeJson
;
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
浏览文件 @
7ac93aff
...
...
@@ -5,9 +5,11 @@ import com.google.gson.JsonObject;
import
java.util.List
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.storage.define.register.InstanceDataDefine
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.skywalking.apm.collector.ui.dao.IGCMetricDAO
;
import
org.skywalking.apm.collector.ui.dao.IInstPerformanceDAO
;
import
org.skywalking.apm.collector.ui.dao.IInstanceDAO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -21,23 +23,29 @@ public class InstanceHealthService {
public
JsonObject
getInstances
(
long
timeBucket
,
int
applicationId
)
{
JsonObject
response
=
new
JsonObject
();
long
s5TimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
timeBucket
);
long
[]
timeBuckets
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBuckets
(
timeBucket
);
long
halfHourBeforeTimeBucket
=
TimeBucketUtils
.
INSTANCE
.
addSecondForSecondTimeBucket
(
TimeBucketUtils
.
TimeBucketType
.
SECOND
.
name
(),
timeBucket
,
-
60
*
30
);
IInstanceDAO
instanceDAO
=
(
IInstanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstanceDAO
.
class
.
getName
());
List
<
InstanceDataDefine
.
Instance
>
instanceList
=
instanceDAO
.
getInstances
(
applicationId
,
halfHourBeforeTimeBucket
);
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
List
<
IInstPerformanceDAO
.
InstPerformance
>
performances
=
instPerformanceDAO
.
getMultiple
(
s5TimeBucket
,
applicationId
);
instanceList
.
forEach
(
instance
->
{
JsonArray
instances
=
new
JsonArray
();
response
.
addProperty
(
"applicationCode"
,
ApplicationCache
.
getForUI
(
applicationId
));
response
.
addProperty
(
"applicationId"
,
applicationId
);
response
.
add
(
"instances"
,
instances
);
JsonArray
instances
=
new
JsonArray
();
response
.
addProperty
(
"applicationCode"
,
ApplicationCache
.
getForUI
(
applicationId
));
response
.
addProperty
(
"applicationId"
,
applicationId
);
response
.
add
(
"instances"
,
instances
);
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
IInstPerformanceDAO
.
InstPerformance
performance
=
instPerformanceDAO
.
get
(
timeBuckets
,
instance
.
getInstanceId
());
IGCMetricDAO
gcMetricDAO
=
(
IGCMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IGCMetricDAO
.
class
.
getName
());
performances
.
forEach
(
instance
->
{
IGCMetricDAO
gcMetricDAO
=
(
IGCMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IGCMetricDAO
.
class
.
getName
());
JsonObject
instanceJson
=
new
JsonObject
();
instanceJson
.
addProperty
(
"id"
,
instance
.
getInstanceId
());
instanceJson
.
addProperty
(
"tps"
,
instance
.
getCallTime
s
());
instanceJson
.
addProperty
(
"tps"
,
performance
.
getCall
s
());
int
avg
=
(
int
)(
instance
.
getCostTotal
()
/
instance
.
getCallTimes
());
int
avg
=
0
;
if
(
performance
.
getCalls
()
!=
0
)
{
avg
=
(
int
)(
performance
.
getCostTotal
()
/
performance
.
getCalls
());
}
instanceJson
.
addProperty
(
"avg"
,
avg
);
if
(
avg
>
5000
)
{
...
...
@@ -50,14 +58,22 @@ public class InstanceHealthService {
instanceJson
.
addProperty
(
"healthLevel"
,
3
);
}
instanceJson
.
addProperty
(
"status"
,
0
);
long
heartBeatTime
=
TimeBucketUtils
.
INSTANCE
.
changeTimeBucket2TimeStamp
(
TimeBucketUtils
.
TimeBucketType
.
SECOND
.
name
(),
instance
.
getHeartBeatTime
());
long
currentTime
=
TimeBucketUtils
.
INSTANCE
.
changeTimeBucket2TimeStamp
(
TimeBucketUtils
.
TimeBucketType
.
SECOND
.
name
(),
timeBucket
);
IGCMetricDAO
.
GCCount
gcCount
=
gcMetricDAO
.
getGCCount
(
s5TimeBucket
,
instance
.
getInstanceId
());
if
(
currentTime
-
heartBeatTime
<
1000
*
60
*
2
)
{
instanceJson
.
addProperty
(
"status"
,
0
);
}
else
{
instanceJson
.
addProperty
(
"status"
,
1
);
}
IGCMetricDAO
.
GCCount
gcCount
=
gcMetricDAO
.
getGCCount
(
timeBuckets
,
instance
.
getInstanceId
());
instanceJson
.
addProperty
(
"ygc"
,
gcCount
.
getYoung
());
instanceJson
.
addProperty
(
"ogc"
,
gcCount
.
getOld
());
instances
.
add
(
instanceJson
);
});
return
response
;
}
}
apm-network/src/main/proto/DiscoveryService.proto
浏览文件 @
7ac93aff
...
...
@@ -27,18 +27,18 @@ message ApplicationInstance {
message
ApplicationInstanceMapping
{
int32
applicationId
=
1
;
int32
applicationI
nstanceId
=
2
;
int32
i
nstanceId
=
2
;
}
message
ApplicationInstanceRecover
{
int32
applicationId
=
1
;
int32
applicationI
nstanceId
=
2
;
int32
i
nstanceId
=
2
;
int64
registerTime
=
3
;
OSInfo
osinfo
=
4
;
}
message
ApplicationInstanceHeartbeat
{
int32
applicationI
nstanceId
=
1
;
int32
i
nstanceId
=
1
;
int64
heartbeatTime
=
2
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录