Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
bdf29e5a
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
1
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,发现更多精彩内容 >>
提交
bdf29e5a
编写于
9月 02, 2017
作者:
P
pengys5
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Jvm metric test success.
#365
上级
9b970184
变更
23
显示空白变更内容
内联
并排
Showing
23 changed file
with
283 addition
and
156 deletion
+283
-156
apm-collector/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
...entjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
+28
-8
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java
.../worker/segment/cost/define/SegmentCostEsTableDefine.java
+2
-2
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java
...kywalking/apm/collector/agentstream/mock/SegmentPost.java
+26
-5
apm-collector/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json
...c/test/resources/json/segment/normal/dubbox-provider.json
+2
-2
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java
...e/elasticsearch/define/ElasticSearchStorageInstaller.java
+6
-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
+6
-7
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
.../skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
+6
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java
.../org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java
+5
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
...skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
+40
-4
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
...skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
+10
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java
...rg/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java
+1
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java
...kywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java
+1
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java
...org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java
+7
-3
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java
...org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
...rg/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java
...kywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java
+6
-0
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java
.../apm/collector/ui/jetty/handler/SegmentTopGetHandler.java
+10
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java
...etty/handler/instancehealth/InstanceHealthGetHandler.java
+6
-6
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java
.../ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java
+6
-6
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
...lking/apm/collector/ui/service/InstanceHealthService.java
+2
-3
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java
...ywalking/apm/collector/ui/service/InstanceJVMService.java
+106
-95
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java
...kywalking/apm/collector/ui/service/SegmentTopService.java
+2
-2
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define
...ctor-ui/src/main/resources/META-INF/defines/es_dao.define
+3
-0
未找到文件。
apm-collector/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
浏览文件 @
bdf29e5a
...
...
@@ -78,14 +78,34 @@ public class JVMMetricsServiceHandlerTestCase {
}
private
static
void
buildMemoryPoolMetric
(
JVMMetric
.
Builder
jvmMetric
)
{
MemoryPool
.
Builder
builder_1
=
MemoryPool
.
newBuilder
();
builder_1
.
setType
(
PoolType
.
NEWGEN_USAGE
);
builder_1
.
setIsHeap
(
true
);
builder_1
.
setInit
(
20
);
builder_1
.
setMax
(
100
);
builder_1
.
setUsed
(
50
);
builder_1
.
setCommited
(
30
);
jvmMetric
.
addMemoryPool
(
builder_1
.
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
NEWGEN_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
NEWGEN_USAGE
,
false
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
OLDGEN_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
OLDGEN_USAGE
,
false
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
METASPACE_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
METASPACE_USAGE
,
false
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
PERMGEN_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
PERMGEN_USAGE
,
false
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
SURVIVOR_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
SURVIVOR_USAGE
,
false
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
CODE_CACHE_USAGE
,
true
).
build
());
jvmMetric
.
addMemoryPool
(
buildMemoryPoolMetric
(
PoolType
.
CODE_CACHE_USAGE
,
false
).
build
());
}
private
static
MemoryPool
.
Builder
buildMemoryPoolMetric
(
PoolType
poolType
,
boolean
isHeap
)
{
MemoryPool
.
Builder
builder
=
MemoryPool
.
newBuilder
();
builder
.
setType
(
poolType
);
builder
.
setIsHeap
(
isHeap
);
builder
.
setInit
(
20
);
builder
.
setMax
(
100
);
builder
.
setUsed
(
50
);
builder
.
setCommited
(
30
);
return
builder
;
}
private
static
void
buildGcMetric
(
JVMMetric
.
Builder
jvmMetric
)
{
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java
浏览文件 @
bdf29e5a
package
org.skywalking.apm.collector.agentstream.worker.segment.cost.define
;
import
org.skywalking.apm.collector.storage.define.segment.SegmentCostTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine
;
import
org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine
;
import
org.skywalking.apm.collector.storage.define.segment.SegmentCostTable
;
/**
* @author pengys5
...
...
@@ -27,7 +27,7 @@ public class SegmentCostEsTableDefine extends ElasticSearchTableDefine {
@Override
public
void
initialize
()
{
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_SEGMENT_ID
,
ElasticSearchColumnDefine
.
Type
.
Keyword
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_SERVICE_NAME
,
ElasticSearchColumnDefine
.
Type
.
Keyword
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_SERVICE_NAME
,
ElasticSearchColumnDefine
.
Type
.
Text
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_COST
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_START_TIME
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
addColumn
(
new
ElasticSearchColumnDefine
(
SegmentCostTable
.
COLUMN_END_TIME
,
ElasticSearchColumnDefine
.
Type
.
Long
.
name
()));
...
...
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java
浏览文件 @
bdf29e5a
...
...
@@ -28,9 +28,9 @@ public class SegmentPost {
InstanceEsDAO
instanceEsDAO
=
new
InstanceEsDAO
();
instanceEsDAO
.
setClient
(
client
);
InstanceDataDefine
.
Instance
consumerInstance
=
new
InstanceDataDefine
.
Instance
(
"2"
,
2
,
"dubbox-consumer"
,
now
,
2
,
now
,
""
);
InstanceDataDefine
.
Instance
consumerInstance
=
new
InstanceDataDefine
.
Instance
(
"2"
,
2
,
"dubbox-consumer"
,
now
,
2
,
now
,
osInfo
(
"consumer"
).
toString
()
);
instanceEsDAO
.
save
(
consumerInstance
);
InstanceDataDefine
.
Instance
providerInstance
=
new
InstanceDataDefine
.
Instance
(
"3"
,
3
,
"dubbox-provider"
,
now
,
3
,
now
,
""
);
InstanceDataDefine
.
Instance
providerInstance
=
new
InstanceDataDefine
.
Instance
(
"3"
,
3
,
"dubbox-provider"
,
now
,
3
,
now
,
osInfo
(
"provider"
).
toString
()
);
instanceEsDAO
.
save
(
providerInstance
);
ApplicationEsDAO
applicationEsDAO
=
new
ApplicationEsDAO
();
...
...
@@ -64,10 +64,13 @@ public class SegmentPost {
modifyTime
(
provider
);
HttpClientTools
.
INSTANCE
.
post
(
"http://localhost:12800/segments"
,
provider
.
toString
());
diff
=
0
;
Thread
.
sleep
(
1000
);
}
}
private
static
long
diff
=
0
;
private
static
void
modifyTime
(
JsonElement
jsonElement
)
{
JsonArray
segmentArray
=
jsonElement
.
getAsJsonArray
();
for
(
JsonElement
element
:
segmentArray
)
{
...
...
@@ -76,10 +79,28 @@ public class SegmentPost {
for
(
JsonElement
span
:
spans
)
{
long
startTime
=
span
.
getAsJsonObject
().
get
(
"st"
).
getAsLong
();
long
endTime
=
span
.
getAsJsonObject
().
get
(
"et"
).
getAsLong
();
long
currentTime
=
System
.
currentTimeMillis
();
span
.
getAsJsonObject
().
addProperty
(
"st"
,
currentTime
);
span
.
getAsJsonObject
().
addProperty
(
"et"
,
currentTime
+
(
endTime
-
startTime
));
if
(
diff
==
0
)
{
diff
=
System
.
currentTimeMillis
()
-
startTime
;
}
span
.
getAsJsonObject
().
addProperty
(
"st"
,
startTime
+
diff
);
span
.
getAsJsonObject
().
addProperty
(
"et"
,
endTime
+
diff
);
}
}
}
private
static
JsonObject
osInfo
(
String
hostName
)
{
JsonObject
osInfoJson
=
new
JsonObject
();
osInfoJson
.
addProperty
(
"osName"
,
"Linux"
);
osInfoJson
.
addProperty
(
"hostName"
,
hostName
);
osInfoJson
.
addProperty
(
"processId"
,
1
);
JsonArray
ipv4Array
=
new
JsonArray
();
ipv4Array
.
add
(
"123.123.123.123"
);
ipv4Array
.
add
(
"124.124.124.124"
);
osInfoJson
.
add
(
"ipv4s"
,
ipv4Array
);
return
osInfoJson
;
}
}
apm-collector/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json
浏览文件 @
bdf29e5a
...
...
@@ -40,8 +40,8 @@
"tv"
:
0
,
"lv"
:
2
,
"ps"
:
-1
,
"st"
:
1501858094
883
,
"et"
:
1501858096
950
,
"st"
:
1501858094
726
,
"et"
:
1501858096
804
,
"ci"
:
3
,
"cn"
:
""
,
"oi"
:
0
,
...
...
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java
浏览文件 @
bdf29e5a
...
...
@@ -53,7 +53,12 @@ public class ElasticSearchStorageInstaller extends StorageInstaller {
return
Settings
.
builder
()
.
put
(
"index.number_of_shards"
,
tableDefine
.
numberOfShards
())
.
put
(
"index.number_of_replicas"
,
tableDefine
.
numberOfReplicas
())
.
put
(
"index.refresh_interval"
,
String
.
valueOf
(
tableDefine
.
refreshInterval
())
+
"s"
).
build
();
.
put
(
"index.refresh_interval"
,
String
.
valueOf
(
tableDefine
.
refreshInterval
())
+
"s"
)
.
put
(
"analysis.analyzer.collector_analyzer.tokenizer"
,
"collector_tokenizer"
)
.
put
(
"analysis.tokenizer.collector_tokenizer.type"
,
"standard"
)
.
put
(
"analysis.tokenizer.collector_tokenizer.max_token_length"
,
5
)
.
build
();
}
private
XContentBuilder
createMappingBuilder
(
ElasticSearchTableDefine
tableDefine
)
throws
IOException
{
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -16,7 +16,6 @@ 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.storage.define.jvm.CpuMetricTable
;
import
org.skywalking.apm.collector.storage.define.jvm.GCMetricTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.network.proto.GCPhrase
;
...
...
@@ -92,8 +91,8 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO {
MultiGetRequestBuilder
youngPrepareMultiGet
=
getClient
().
prepareMultiGet
();
int
i
=
0
;
do
{
String
youngId
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
GCPhrase
.
NEW_VALUE
+
instanceId
;
youngPrepareMultiGet
.
add
(
CpuMetricTable
.
TABLE
,
Cpu
MetricTable
.
TABLE_TYPE
,
youngId
);
String
youngId
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
GCPhrase
.
NEW_VALUE
;
youngPrepareMultiGet
.
add
(
GCMetricTable
.
TABLE
,
GC
MetricTable
.
TABLE_TYPE
,
youngId
);
i
++;
}
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
...
...
@@ -102,7 +101,7 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO {
MultiGetResponse
multiGetResponse
=
youngPrepareMultiGet
.
get
();
for
(
MultiGetItemResponse
itemResponse
:
multiGetResponse
.
getResponses
())
{
if
(
itemResponse
.
getResponse
().
isExists
())
{
youngArray
.
add
(((
Number
)
itemResponse
.
getResponse
().
getSource
().
get
(
CpuMetricTable
.
COLUMN_USAGE_PERCE
NT
)).
intValue
());
youngArray
.
add
(((
Number
)
itemResponse
.
getResponse
().
getSource
().
get
(
GCMetricTable
.
COLUMN_COU
NT
)).
intValue
());
}
else
{
youngArray
.
add
(
0
);
}
...
...
@@ -112,8 +111,8 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO {
MultiGetRequestBuilder
oldPrepareMultiGet
=
getClient
().
prepareMultiGet
();
i
=
0
;
do
{
String
oldId
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
GCPhrase
.
OLD_VALUE
+
instanceId
;
oldPrepareMultiGet
.
add
(
CpuMetricTable
.
TABLE
,
Cpu
MetricTable
.
TABLE_TYPE
,
oldId
);
String
oldId
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
GCPhrase
.
OLD_VALUE
;
oldPrepareMultiGet
.
add
(
GCMetricTable
.
TABLE
,
GC
MetricTable
.
TABLE_TYPE
,
oldId
);
i
++;
}
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
...
...
@@ -123,7 +122,7 @@ public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO {
multiGetResponse
=
oldPrepareMultiGet
.
get
();
for
(
MultiGetItemResponse
itemResponse
:
multiGetResponse
.
getResponses
())
{
if
(
itemResponse
.
getResponse
().
isExists
())
{
oldArray
.
add
(((
Number
)
itemResponse
.
getResponse
().
getSource
().
get
(
CpuMetricTable
.
COLUMN_USAGE_PERCE
NT
)).
intValue
());
oldArray
.
add
(((
Number
)
itemResponse
.
getResponse
().
getSource
().
get
(
GCMetricTable
.
COLUMN_COU
NT
)).
intValue
());
}
else
{
oldArray
.
add
(
0
);
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -9,9 +9,13 @@ import java.util.List;
public
interface
IInstPerformanceDAO
{
List
<
InstPerformance
>
getMultiple
(
long
timeBucket
,
int
applicationId
);
int
getMetric
(
int
instanceId
,
long
timeBucket
);
int
get
Tps
Metric
(
int
instanceId
,
long
timeBucket
);
JsonArray
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
);
JsonArray
getTpsMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
);
int
getRespTimeMetric
(
int
instanceId
,
long
timeBucket
);
JsonArray
getRespTimeMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
);
class
InstPerformance
{
private
final
int
instanceId
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -7,5 +7,9 @@ import com.google.gson.JsonObject;
*/
public
interface
ISegmentCostDAO
{
JsonObject
loadTop
(
long
startTime
,
long
endTime
,
long
minCost
,
long
maxCost
,
String
operationName
,
String
globalTraceId
,
int
limit
,
int
from
);
String
globalTraceId
,
int
limit
,
int
from
,
Sort
sort
);
public
enum
Sort
{
Cost
,
Time
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -18,7 +18,6 @@ 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.storage.define.instance.InstPerformanceTable
;
import
org.skywalking.apm.collector.storage.define.jvm.CpuMetricTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
/**
...
...
@@ -68,7 +67,7 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
return
instPerformances
;
}
@Override
public
int
getMetric
(
int
instanceId
,
long
timeBucket
)
{
@Override
public
int
get
Tps
Metric
(
int
instanceId
,
long
timeBucket
)
{
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
;
GetResponse
getResponse
=
getClient
().
prepareGet
(
InstPerformanceTable
.
TABLE
,
id
).
get
();
...
...
@@ -78,13 +77,13 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
return
0
;
}
@Override
public
JsonArray
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
@Override
public
JsonArray
get
Tps
Metric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
MultiGetRequestBuilder
prepareMultiGet
=
getClient
().
prepareMultiGet
();
int
i
=
0
;
do
{
String
id
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
instanceId
;
prepareMultiGet
.
add
(
CpuMetric
Table
.
TABLE
,
InstPerformanceTable
.
TABLE_TYPE
,
id
);
prepareMultiGet
.
add
(
InstPerformance
Table
.
TABLE
,
InstPerformanceTable
.
TABLE_TYPE
,
id
);
i
++;
}
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
...
...
@@ -100,4 +99,41 @@ public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO {
}
return
metrics
;
}
@Override
public
int
getRespTimeMetric
(
int
instanceId
,
long
timeBucket
)
{
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
;
GetResponse
getResponse
=
getClient
().
prepareGet
(
InstPerformanceTable
.
TABLE
,
id
).
get
();
if
(
getResponse
.
isExists
())
{
int
callTimes
=
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL_TIMES
)).
intValue
();
int
costTotal
=
((
Number
)
getResponse
.
getSource
().
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
)).
intValue
();
return
costTotal
/
callTimes
;
}
return
0
;
}
@Override
public
JsonArray
getRespTimeMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
MultiGetRequestBuilder
prepareMultiGet
=
getClient
().
prepareMultiGet
();
int
i
=
0
;
do
{
String
id
=
(
startTimeBucket
+
i
)
+
Const
.
ID_SPLIT
+
instanceId
;
prepareMultiGet
.
add
(
InstPerformanceTable
.
TABLE
,
InstPerformanceTable
.
TABLE_TYPE
,
id
);
i
++;
}
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
JsonArray
metrics
=
new
JsonArray
();
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
int
callTimes
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_CALL_TIMES
)).
intValue
();
int
costTotal
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
InstPerformanceTable
.
COLUMN_COST_TOTAL
)).
intValue
();
metrics
.
add
(
costTotal
/
callTimes
);
}
else
{
metrics
.
add
(
0
);
}
}
return
metrics
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java
浏览文件 @
bdf29e5a
...
...
@@ -13,11 +13,19 @@ public class InstPerformanceH2DAO extends H2DAO implements IInstPerformanceDAO {
return
null
;
}
@Override
public
int
getMetric
(
int
instanceId
,
long
timeBucket
)
{
@Override
public
int
get
Tps
Metric
(
int
instanceId
,
long
timeBucket
)
{
return
0
;
}
@Override
public
JsonArray
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
@Override
public
JsonArray
getTpsMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
return
null
;
}
@Override
public
int
getRespTimeMetric
(
int
instanceId
,
long
timeBucket
)
{
return
0
;
}
@Override
public
JsonArray
getRespTimeMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
)
{
return
null
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -44,9 +44,7 @@ public class MemoryMetricEsDAO extends EsDAO implements IMemoryMetricDAO {
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
JsonObject
metric
=
new
JsonObject
();
JsonArray
usedMetric
=
new
JsonArray
();
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
...
...
@@ -57,6 +55,7 @@ public class MemoryMetricEsDAO extends EsDAO implements IMemoryMetricDAO {
usedMetric
.
add
(
0
);
}
}
metric
.
add
(
"used"
,
usedMetric
);
return
metric
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -45,9 +45,7 @@ public class MemoryPoolMetricEsDAO extends EsDAO implements IMemoryPoolMetricDAO
while
(
startTimeBucket
+
i
<=
endTimeBucket
);
JsonObject
metric
=
new
JsonObject
();
JsonArray
usedMetric
=
new
JsonArray
();
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
...
...
@@ -58,6 +56,7 @@ public class MemoryPoolMetricEsDAO extends EsDAO implements IMemoryPoolMetricDAO
usedMetric
.
add
(
0
);
}
}
metric
.
add
(
"used"
,
usedMetric
);
return
metric
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -15,9 +15,9 @@ import org.elasticsearch.search.sort.SortOrder;
import
org.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.storage.define.global.GlobalTraceTable
;
import
org.skywalking.apm.collector.storage.define.segment.SegmentCostTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
/**
* @author pengys5
...
...
@@ -25,7 +25,7 @@ import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable;
public
class
SegmentCostEsDAO
extends
EsDAO
implements
ISegmentCostDAO
{
@Override
public
JsonObject
loadTop
(
long
startTime
,
long
endTime
,
long
minCost
,
long
maxCost
,
String
operationName
,
String
globalTraceId
,
int
limit
,
int
from
)
{
String
globalTraceId
,
int
limit
,
int
from
,
Sort
sort
)
{
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
SegmentCostTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
SegmentCostTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
...
...
@@ -48,7 +48,11 @@ public class SegmentCostEsDAO extends EsDAO implements ISegmentCostDAO {
mustQueryList
.
add
(
QueryBuilders
.
matchQuery
(
SegmentCostTable
.
COLUMN_SERVICE_NAME
,
operationName
));
}
if
(
Sort
.
Cost
.
equals
(
sort
))
{
searchRequestBuilder
.
addSort
(
SegmentCostTable
.
COLUMN_COST
,
SortOrder
.
DESC
);
}
else
if
(
Sort
.
Time
.
equals
(
sort
))
{
searchRequestBuilder
.
addSort
(
SegmentCostTable
.
COLUMN_START_TIME
,
SortOrder
.
DESC
);
}
searchRequestBuilder
.
setSize
(
limit
);
searchRequestBuilder
.
setFrom
(
from
);
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java
浏览文件 @
bdf29e5a
...
...
@@ -8,7 +8,7 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
SegmentCostH2DAO
extends
H2DAO
implements
ISegmentCostDAO
{
@Override
public
JsonObject
loadTop
(
long
startTime
,
long
endTime
,
long
minCost
,
long
maxCost
,
String
operationName
,
String
globalTraceId
,
int
limit
,
int
from
)
{
String
globalTraceId
,
int
limit
,
int
from
,
Sort
sort
)
{
return
null
;
}
}
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
浏览文件 @
bdf29e5a
...
...
@@ -37,7 +37,7 @@ public class ServiceEntryEsDAO extends EsDAO implements IServiceEntryDAO {
boolQueryBuilder
.
must
().
add
(
QueryBuilders
.
matchQuery
(
ServiceEntryTable
.
COLUMN_APPLICATION_ID
,
applicationId
));
}
if
(
StringUtils
.
isNotEmpty
(
entryServiceName
))
{
boolQueryBuilder
.
must
().
add
(
QueryBuilders
.
term
Query
(
ServiceEntryTable
.
COLUMN_ENTRY_SERVICE_NAME
,
entryServiceName
));
boolQueryBuilder
.
must
().
add
(
QueryBuilders
.
match
Query
(
ServiceEntryTable
.
COLUMN_ENTRY_SERVICE_NAME
,
entryServiceName
));
}
searchRequestBuilder
.
setQuery
(
boolQueryBuilder
);
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java
浏览文件 @
bdf29e5a
...
...
@@ -17,6 +17,9 @@ import org.skywalking.apm.collector.ui.jetty.handler.TraceStackGetHandler;
import
org.skywalking.apm.collector.ui.jetty.handler.UIJettyServerHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.application.ApplicationsGetHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.instancehealth.InstanceHealthGetHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetOneTimeBucketHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetRangeTimeBucketHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceOsInfoGetHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.servicetree.EntryServiceGetHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.servicetree.ServiceTreeGetHandler
;
import
org.skywalking.apm.collector.ui.jetty.handler.time.AllInstanceLastTimeGetHandler
;
...
...
@@ -64,6 +67,9 @@ public class UIJettyModuleDefine extends UIModuleDefine {
handlers
.
add
(
new
AllInstanceLastTimeGetHandler
());
handlers
.
add
(
new
InstanceHealthGetHandler
());
handlers
.
add
(
new
ApplicationsGetHandler
());
handlers
.
add
(
new
InstanceOsInfoGetHandler
());
handlers
.
add
(
new
InstanceMetricGetOneTimeBucketHandler
());
handlers
.
add
(
new
InstanceMetricGetRangeTimeBucketHandler
());
handlers
.
add
(
new
EntryServiceGetHandler
());
handlers
.
add
(
new
ServiceTreeGetHandler
());
return
handlers
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java
浏览文件 @
bdf29e5a
...
...
@@ -4,6 +4,7 @@ import com.google.gson.JsonElement;
import
javax.servlet.http.HttpServletRequest
;
import
org.skywalking.apm.collector.server.jetty.ArgumentsParseException
;
import
org.skywalking.apm.collector.server.jetty.JettyHandler
;
import
org.skywalking.apm.collector.ui.dao.ISegmentCostDAO
;
import
org.skywalking.apm.collector.ui.service.SegmentTopService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -77,7 +78,15 @@ public class SegmentTopGetHandler extends JettyHandler {
operationName
=
req
.
getParameter
(
"operationName"
);
}
return
service
.
loadTop
(
startTime
,
endTime
,
minCost
,
maxCost
,
operationName
,
globalTraceId
,
limit
,
from
);
ISegmentCostDAO
.
Sort
sort
=
ISegmentCostDAO
.
Sort
.
Cost
;
if
(
req
.
getParameterMap
().
containsKey
(
"sort"
))
{
String
sortStr
=
req
.
getParameter
(
"sort"
);
if
(
sortStr
.
toLowerCase
().
equals
(
ISegmentCostDAO
.
Sort
.
Time
.
name
().
toLowerCase
()))
{
sort
=
ISegmentCostDAO
.
Sort
.
Time
;
}
}
return
service
.
loadTop
(
startTime
,
endTime
,
minCost
,
maxCost
,
operationName
,
globalTraceId
,
limit
,
from
,
sort
);
}
@Override
protected
JsonElement
doPost
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java
浏览文件 @
bdf29e5a
...
...
@@ -24,13 +24,13 @@ public class InstanceHealthGetHandler extends JettyHandler {
private
InstanceHealthService
service
=
new
InstanceHealthService
();
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
String
time
stampStr
=
req
.
getParameter
(
"timestamp
"
);
String
time
BucketStr
=
req
.
getParameter
(
"timeBucket
"
);
String
[]
applicationIdsStr
=
req
.
getParameterValues
(
"applicationIds"
);
logger
.
debug
(
"instance health get time
stamp: {}, applicationIdsStr: {}"
,
timestamp
Str
,
applicationIdsStr
);
logger
.
debug
(
"instance health get time
Bucket: {}, applicationIdsStr: {}"
,
timeBucket
Str
,
applicationIdsStr
);
long
time
stamp
;
long
time
Bucket
;
try
{
time
stamp
=
Long
.
parseLong
(
timestamp
Str
);
time
Bucket
=
Long
.
parseLong
(
timeBucket
Str
);
}
catch
(
NumberFormatException
e
)
{
throw
new
ArgumentsParseException
(
"timestamp must be long"
);
}
...
...
@@ -45,12 +45,12 @@ public class InstanceHealthGetHandler extends JettyHandler {
}
JsonObject
response
=
new
JsonObject
();
response
.
addProperty
(
"time
stamp"
,
timestamp
);
response
.
addProperty
(
"time
Bucket"
,
timeBucket
);
JsonArray
appInstances
=
new
JsonArray
();
response
.
add
(
"appInstances"
,
appInstances
);
for
(
int
applicationId
:
applicationIds
)
{
appInstances
.
add
(
service
.
getInstances
(
time
stamp
,
applicationId
));
appInstances
.
add
(
service
.
getInstances
(
time
Bucket
,
applicationId
));
}
return
response
;
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java
浏览文件 @
bdf29e5a
...
...
@@ -23,18 +23,18 @@ public class OneInstanceLastTimeGetHandler extends JettyHandler {
private
TimeSynchronousService
service
=
new
TimeSynchronousService
();
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
String
applicationInstanceIdStr
=
req
.
getParameter
(
"applicationI
nstanceId"
);
logger
.
debug
(
"
applicationInstanceId: {}"
,
applicationI
nstanceIdStr
);
String
instanceIdStr
=
req
.
getParameter
(
"i
nstanceId"
);
logger
.
debug
(
"
instanceId: {}"
,
i
nstanceIdStr
);
int
applicationI
nstanceId
;
int
i
nstanceId
;
try
{
applicationInstanceId
=
Integer
.
parseInt
(
applicationI
nstanceIdStr
);
instanceId
=
Integer
.
parseInt
(
i
nstanceIdStr
);
}
catch
(
NumberFormatException
e
)
{
throw
new
ArgumentsParseException
(
"application instance id must be integer"
);
}
Long
time
=
service
.
instanceLastTime
(
applicationI
nstanceId
);
logger
.
debug
(
"application instance id: {}, instance last time: {}"
,
applicationI
nstanceId
,
time
);
Long
time
=
service
.
instanceLastTime
(
i
nstanceId
);
logger
.
debug
(
"application instance id: {}, instance last time: {}"
,
i
nstanceId
,
time
);
JsonObject
timeJson
=
new
JsonObject
();
timeJson
.
addProperty
(
"timeBucket"
,
time
);
return
timeJson
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
浏览文件 @
bdf29e5a
...
...
@@ -18,11 +18,10 @@ public class InstanceHealthService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InstanceHealthService
.
class
);
public
JsonObject
getInstances
(
long
time
stamp
,
int
applicationId
)
{
public
JsonObject
getInstances
(
long
time
Bucket
,
int
applicationId
)
{
JsonObject
response
=
new
JsonObject
();
long
secondTimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getSecondTimeBucket
(
timestamp
);
long
s5TimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
secondTimeBucket
);
long
s5TimeBucket
=
TimeBucketUtils
.
INSTANCE
.
getFiveSecondTimeBucket
(
timeBucket
);
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
List
<
IInstPerformanceDAO
.
InstPerformance
>
performances
=
instPerformanceDAO
.
getMultiple
(
s5TimeBucket
,
applicationId
);
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java
浏览文件 @
bdf29e5a
...
...
@@ -39,113 +39,124 @@ public class InstanceJVMService {
public
JsonObject
getInstanceJvmMetric
(
int
instanceId
,
Set
<
String
>
metricTypes
,
long
timeBucket
)
{
JsonObject
metrics
=
new
JsonObject
();
if
(
metricTypes
.
contains
(
MetricType
.
cpu
.
name
()))
{
for
(
String
metricType
:
metricTypes
)
{
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
cpu
.
name
()))
{
ICpuMetricDAO
cpuMetricDAO
=
(
ICpuMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
ICpuMetricDAO
.
class
.
getName
());
metrics
.
addProperty
(
MetricType
.
cpu
.
name
(),
cpuMetricDAO
.
getMetric
(
instanceId
,
timeBucket
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
gc
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
gc
.
name
()))
{
IGCMetricDAO
gcMetricDAO
=
(
IGCMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IGCMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
gc
.
name
(),
gcMetricDAO
.
getMetric
(
instanceId
,
timeBucket
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
tps
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
tps
.
name
()))
{
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
metrics
.
addProperty
(
MetricType
.
tps
.
name
(),
instPerformanceDAO
.
getMetric
(
instanceId
,
timeBucket
));
}
else
if
(
metricTypes
.
contains
(
MetricType
.
heapmemory
.
name
()))
{
metrics
.
addProperty
(
MetricType
.
tps
.
name
(),
instPerformanceDAO
.
getTpsMetric
(
instanceId
,
timeBucket
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
resptime
.
name
()))
{
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
metrics
.
addProperty
(
MetricType
.
resptime
.
name
(),
instPerformanceDAO
.
getRespTimeMetric
(
instanceId
,
timeBucket
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
heapmemory
.
name
()))
{
IMemoryMetricDAO
memoryMetricDAO
=
(
IMemoryMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapmemory
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapmemory
.
name
()))
{
IMemoryMetricDAO
memoryMetricDAO
=
(
IMemoryMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heappermgen
.
name
()))
{
metrics
.
add
(
MetricType
.
non
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
));
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heappermgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heappermgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapmetaspace
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapmetaspace
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmetaspace
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
,
PoolType
.
METASPACE_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapnewgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapnewgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
,
PoolType
.
NEWGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapoldgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapoldgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapoldgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapsurvivor
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapsurvivor
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapsurvivor
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
,
PoolType
.
SURVIVOR_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheappermgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheappermgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheappermgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapmetaspace
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapmetaspace
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapmetaspace
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
,
PoolType
.
METASPACE_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapnewgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapnewgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
,
PoolType
.
NEWGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapoldgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapoldgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapsurvivor
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapsurvivor
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapsurvivor
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
{
throw
new
UnexpectedException
(
"unexpected metric type"
);
}
}
return
metrics
;
}
public
JsonObject
getInstanceJvmMetrics
(
int
instanceId
,
Set
<
String
>
metricTypes
,
long
startTimeBucket
,
long
endTimeBucket
)
{
JsonObject
metrics
=
new
JsonObject
();
if
(
metricTypes
.
contains
(
MetricType
.
cpu
.
name
()))
{
for
(
String
metricType
:
metricTypes
)
{
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
cpu
.
name
()))
{
ICpuMetricDAO
cpuMetricDAO
=
(
ICpuMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
ICpuMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
cpu
.
name
(),
cpuMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
gc
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
gc
.
name
()))
{
IGCMetricDAO
gcMetricDAO
=
(
IGCMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IGCMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
gc
.
name
(),
gcMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
));
}
else
if
(
metricTypes
.
contains
(
MetricType
.
tps
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
tps
.
name
()))
{
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
tps
.
name
(),
instPerformanceDAO
.
getTpsMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
resptime
.
name
()))
{
IInstPerformanceDAO
instPerformanceDAO
=
(
IInstPerformanceDAO
)
DAOContainer
.
INSTANCE
.
get
(
IInstPerformanceDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
tps
.
name
(),
instPerformanceDAO
.
get
Metric
(
instanceId
,
startTimeBucket
,
endTimeBucket
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapmemory
.
name
()))
{
metrics
.
add
(
MetricType
.
resptime
.
name
(),
instPerformanceDAO
.
getRespTime
Metric
(
instanceId
,
startTimeBucket
,
endTimeBucket
));
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapmemory
.
name
()))
{
IMemoryMetricDAO
memoryMetricDAO
=
(
IMemoryMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapmemory
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapmemory
.
name
()))
{
IMemoryMetricDAO
memoryMetricDAO
=
(
IMemoryMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heappermgen
.
name
()))
{
metrics
.
add
(
MetricType
.
non
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
));
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heappermgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heappermgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapmetaspace
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapmetaspace
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapmetaspace
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
,
PoolType
.
METASPACE_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapnewgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapnewgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
,
PoolType
.
NEWGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapoldgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapoldgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapoldgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
heapsurvivor
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
heapsurvivor
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
heapsurvivor
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
,
PoolType
.
SURVIVOR_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheappermgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheappermgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheappermgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapmetaspace
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapmetaspace
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapmetaspace
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
,
PoolType
.
METASPACE_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapnewgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapnewgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
,
PoolType
.
NEWGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapoldgen
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapoldgen
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapnewgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
if
(
metricTypes
.
contain
s
(
MetricType
.
nonheapsurvivor
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equal
s
(
MetricType
.
nonheapsurvivor
.
name
()))
{
IMemoryPoolMetricDAO
memoryPoolMetricDAO
=
(
IMemoryPoolMetricDAO
)
DAOContainer
.
INSTANCE
.
get
(
IMemoryPoolMetricDAO
.
class
.
getName
());
metrics
.
add
(
MetricType
.
nonheapsurvivor
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
,
PoolType
.
OLDGEN_USAGE_VALUE
));
}
else
{
throw
new
UnexpectedException
(
"unexpected metric type"
);
}
}
return
metrics
;
}
public
enum
MetricType
{
cpu
,
gc
,
tps
,
heapmemory
,
heappermgen
,
heapmetaspace
,
heapnewgen
,
cpu
,
gc
,
tps
,
resptime
,
heapmemory
,
heappermgen
,
heapmetaspace
,
heapnewgen
,
heapoldgen
,
heapsurvivor
,
nonheapmemory
,
nonheappermgen
,
nonheapmetaspace
,
nonheapnewgen
,
nonheapoldgen
,
nonheapsurvivor
}
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java
浏览文件 @
bdf29e5a
...
...
@@ -14,9 +14,9 @@ public class SegmentTopService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SegmentTopService
.
class
);
public
JsonObject
loadTop
(
long
startTime
,
long
endTime
,
long
minCost
,
long
maxCost
,
String
operationName
,
String
globalTraceId
,
int
limit
,
int
from
)
{
String
globalTraceId
,
int
limit
,
int
from
,
ISegmentCostDAO
.
Sort
sort
)
{
logger
.
debug
(
"startTime: {}, endTime: {}, minCost: {}, maxCost: {}, operationName: {}, globalTraceId: {}, limit: {}, from: {}"
,
startTime
,
endTime
,
minCost
,
maxCost
,
operationName
,
globalTraceId
,
limit
,
from
);
ISegmentCostDAO
segmentCostDAO
=
(
ISegmentCostDAO
)
DAOContainer
.
INSTANCE
.
get
(
ISegmentCostDAO
.
class
.
getName
());
return
segmentCostDAO
.
loadTop
(
startTime
,
endTime
,
minCost
,
maxCost
,
operationName
,
globalTraceId
,
limit
,
from
);
return
segmentCostDAO
.
loadTop
(
startTime
,
endTime
,
minCost
,
maxCost
,
operationName
,
globalTraceId
,
limit
,
from
,
sort
);
}
}
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define
浏览文件 @
bdf29e5a
...
...
@@ -8,6 +8,9 @@ org.skywalking.apm.collector.ui.dao.ApplicationEsDAO
org.skywalking.apm.collector.ui.dao.ServiceNameEsDAO
org.skywalking.apm.collector.ui.dao.InstanceEsDAO
org.skywalking.apm.collector.ui.dao.InstPerformanceEsDAO
org.skywalking.apm.collector.ui.dao.CpuMetricEsDAO
org.skywalking.apm.collector.ui.dao.GCMetricEsDAO
org.skywalking.apm.collector.ui.dao.MemoryMetricEsDAO
org.skywalking.apm.collector.ui.dao.MemoryPoolMetricEsDAO
org.skywalking.apm.collector.ui.dao.ServiceEntryEsDAO
org.skywalking.apm.collector.ui.dao.ServiceReferenceEsDAO
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录