Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
474e47c9
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,发现更多精彩内容 >>
提交
474e47c9
编写于
1月 31, 2018
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide the getMemoryTrend query.
上级
06d5b88e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
141 addition
and
94 deletion
+141
-94
apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java
...or/analysis/jvm/provider/service/MemoryMetricService.java
+1
-1
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IMemoryMetricUIDAO.java
...walking/apm/collector/storage/dao/IMemoryMetricUIDAO.java
+32
-3
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/MemoryTrend.java
...ywalking/apm/collector/storage/ui/server/MemoryTrend.java
+32
-0
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java
...ing/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java
+27
-36
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java
...ing/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java
+26
-45
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
...apache/skywalking/apm/collector/ui/query/ServerQuery.java
+4
-2
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceJVMService.java
...ywalking/apm/collector/ui/service/InstanceJVMService.java
+0
-4
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
...he/skywalking/apm/collector/ui/service/ServerService.java
+19
-3
未找到文件。
apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java
浏览文件 @
474e47c9
...
...
@@ -47,7 +47,7 @@ public class MemoryMetricService implements IMemoryMetricService {
@Override
public
void
send
(
int
instanceId
,
long
timeBucket
,
boolean
isHeap
,
long
init
,
long
max
,
long
used
,
long
committed
)
{
String
metricId
=
instanceId
+
Const
.
ID_SPLIT
+
String
.
valueOf
(
isHeap
);
String
metricId
=
instanceId
+
Const
.
ID_SPLIT
+
BooleanUtils
.
booleanToValue
(
isHeap
);
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
metricId
;
MemoryMetric
memoryMetric
=
new
MemoryMetric
();
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IMemoryMetricUIDAO.java
浏览文件 @
474e47c9
...
...
@@ -18,14 +18,43 @@
package
org.apache.skywalking.apm.collector.storage.dao
;
import
com.google.gson.JsonObject
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.storage.base.dao.DAO
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.utils.DurationPoint
;
/**
* @author peng-yongsheng
*/
public
interface
IMemoryMetricUIDAO
extends
DAO
{
JsonObject
getMetric
(
int
instanceId
,
long
timeBucket
,
boolean
isHeap
);
Trend
getHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
);
JsonObject
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
,
boolean
isHeap
);
Trend
getNoHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
);
class
Trend
{
private
List
<
Integer
>
metrics
;
private
List
<
Integer
>
maxMetrics
;
public
Trend
()
{
this
.
metrics
=
new
LinkedList
<>();
this
.
maxMetrics
=
new
LinkedList
<>();
}
public
List
<
Integer
>
getMetrics
()
{
return
metrics
;
}
public
void
setMetrics
(
List
<
Integer
>
metrics
)
{
this
.
metrics
=
metrics
;
}
public
List
<
Integer
>
getMaxMetrics
()
{
return
maxMetrics
;
}
public
void
setMaxMetrics
(
List
<
Integer
>
maxMetrics
)
{
this
.
maxMetrics
=
maxMetrics
;
}
}
}
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/MemoryTrend.java
浏览文件 @
474e47c9
...
...
@@ -28,4 +28,36 @@ public class MemoryTrend {
private
List
<
Integer
>
maxHeap
;
private
List
<
Integer
>
noheap
;
private
List
<
Integer
>
maxNoheap
;
public
List
<
Integer
>
getHeap
()
{
return
heap
;
}
public
void
setHeap
(
List
<
Integer
>
heap
)
{
this
.
heap
=
heap
;
}
public
List
<
Integer
>
getMaxHeap
()
{
return
maxHeap
;
}
public
void
setMaxHeap
(
List
<
Integer
>
maxHeap
)
{
this
.
maxHeap
=
maxHeap
;
}
public
List
<
Integer
>
getNoheap
()
{
return
noheap
;
}
public
void
setNoheap
(
List
<
Integer
>
noheap
)
{
this
.
noheap
=
noheap
;
}
public
List
<
Integer
>
getMaxNoheap
()
{
return
maxNoheap
;
}
public
void
setMaxNoheap
(
List
<
Integer
>
maxNoheap
)
{
this
.
maxNoheap
=
maxNoheap
;
}
}
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java
浏览文件 @
474e47c9
...
...
@@ -18,14 +18,16 @@
package
org.apache.skywalking.apm.collector.storage.es.dao
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.apache.skywalking.apm.collector.core.util.BooleanUtils
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.utils.DurationPoint
;
import
org.apache.skywalking.apm.collector.storage.utils.TimePyramidTableNameBuilder
;
import
org.elasticsearch.action.get.MultiGetItemResponse
;
import
org.elasticsearch.action.get.MultiGetRequestBuilder
;
import
org.elasticsearch.action.get.MultiGetResponse
;
...
...
@@ -39,50 +41,39 @@ public class MemoryMetricEsUIDAO extends EsDAO implements IMemoryMetricUIDAO {
super
(
client
);
}
@Override
public
JsonObject
getMetric
(
int
instanceId
,
long
timeBucket
,
boolean
isHeap
)
{
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
isHeap
;
GetResponse
getResponse
=
getClient
().
prepareGet
(
MemoryMetricTable
.
TABLE
,
id
).
get
();
@Override
public
Trend
getHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
)
{
return
getMemoryTrend
(
instanceId
,
step
,
durationPoints
,
true
)
;
}
JsonObject
metric
=
new
JsonObject
();
if
(
getResponse
.
isExists
())
{
metric
.
addProperty
(
"max"
,
((
Number
)
getResponse
.
getSource
().
get
(
MemoryMetricTable
.
COLUMN_MAX
)).
intValue
());
metric
.
addProperty
(
"init"
,
((
Number
)
getResponse
.
getSource
().
get
(
MemoryMetricTable
.
COLUMN_INIT
)).
intValue
());
metric
.
addProperty
(
"used"
,
((
Number
)
getResponse
.
getSource
().
get
(
MemoryMetricTable
.
COLUMN_USED
)).
intValue
());
}
else
{
metric
.
addProperty
(
"max"
,
0
);
metric
.
addProperty
(
"init"
,
0
);
metric
.
addProperty
(
"used"
,
0
);
}
return
metric
;
@Override
public
Trend
getNoHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
)
{
return
getMemoryTrend
(
instanceId
,
step
,
durationPoints
,
false
);
}
@Override
public
JsonObject
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
,
boolean
isHeap
)
{
private
Trend
getMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
,
boolean
isHeap
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
MemoryMetricTable
.
TABLE
);
MultiGetRequestBuilder
prepareMultiGet
=
getClient
().
prepareMultiGet
();
int
i
=
0
;
long
timeBucket
=
startTimeBucket
;
do
{
// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1);
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
isHeap
;
prepareMultiGet
.
add
(
MemoryMetricTable
.
TABLE
,
MemoryMetricTable
.
TABLE_TYPE
,
id
);
}
while
(
timeBucket
<=
endTimeBucket
);
durationPoints
.
forEach
(
durationPoint
->
{
String
id
=
durationPoint
.
getPoint
()
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
BooleanUtils
.
booleanToValue
(
isHeap
);
prepareMultiGet
.
add
(
tableName
,
MemoryMetricTable
.
TABLE_TYPE
,
id
);
});
JsonObject
metric
=
new
JsonObject
();
JsonArray
usedMetric
=
new
JsonArray
();
Trend
trend
=
new
Trend
();
MultiGetResponse
multiGetResponse
=
prepareMultiGet
.
get
();
for
(
MultiGetItemResponse
response
:
multiGetResponse
.
getResponses
())
{
if
(
response
.
getResponse
().
isExists
())
{
metric
.
addProperty
(
"max"
,
((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_MAX
)).
longValue
());
metric
.
addProperty
(
"init"
,
((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_INIT
)).
longValue
());
usedMetric
.
add
(((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_USED
)).
longValue
());
long
max
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_MAX
)).
longValue
();
long
used
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_USED
)).
longValue
();
long
times
=
((
Number
)
response
.
getResponse
().
getSource
().
get
(
MemoryMetricTable
.
COLUMN_TIMES
)).
longValue
();
trend
.
getMetrics
().
add
((
int
)(
used
/
times
));
trend
.
getMaxMetrics
().
add
((
int
)(
max
/
times
));
}
else
{
metric
.
addProperty
(
"max"
,
0
);
metric
.
addProperty
(
"init"
,
0
);
usedMetric
.
add
(
0
);
trend
.
getMetrics
().
add
(
0
);
trend
.
getMaxMetrics
().
add
(
0
);
}
}
metric
.
add
(
"used"
,
usedMetric
);
return
metric
;
return
trend
;
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java
浏览文件 @
474e47c9
...
...
@@ -18,19 +18,20 @@
package
org.apache.skywalking.apm.collector.storage.h2.dao
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.client.h2.H2ClientException
;
import
org.apache.skywalking.apm.collector.core.util.BooleanUtils
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.utils.DurationPoint
;
import
org.apache.skywalking.apm.collector.storage.utils.TimePyramidTableNameBuilder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -46,60 +47,40 @@ public class MemoryMetricH2UIDAO extends H2DAO implements IMemoryMetricUIDAO {
super
(
client
);
}
@Override
public
JsonObject
getMetric
(
int
instanceId
,
long
timeBucket
,
boolean
isHeap
)
{
H2Client
client
=
getClient
();
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
isHeap
;
String
sql
=
SqlBuilder
.
buildSql
(
GET_MEMORY_METRIC_SQL
,
MemoryMetricTable
.
TABLE
,
MemoryMetricTable
.
COLUMN_ID
);
Object
[]
params
=
new
Object
[]
{
id
};
JsonObject
metric
=
new
JsonObject
();
try
(
ResultSet
rs
=
client
.
executeQuery
(
sql
,
params
))
{
if
(
rs
.
next
())
{
metric
.
addProperty
(
"max"
,
rs
.
getInt
(
MemoryMetricTable
.
COLUMN_MAX
));
metric
.
addProperty
(
"init"
,
rs
.
getInt
(
MemoryMetricTable
.
COLUMN_INIT
));
metric
.
addProperty
(
"used"
,
rs
.
getInt
(
MemoryMetricTable
.
COLUMN_USED
));
}
else
{
metric
.
addProperty
(
"max"
,
0
);
metric
.
addProperty
(
"init"
,
0
);
metric
.
addProperty
(
"used"
,
0
);
}
}
catch
(
SQLException
|
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
metric
;
@Override
public
Trend
getHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
)
{
return
getMemoryTrend
(
instanceId
,
step
,
durationPoints
,
true
);
}
@Override
public
JsonObject
getMetric
(
int
instanceId
,
long
startTimeBucket
,
long
endTimeBucket
,
boolean
isHeap
)
{
H2Client
client
=
getClient
();
String
sql
=
SqlBuilder
.
buildSql
(
GET_MEMORY_METRIC_SQL
,
MemoryMetricTable
.
TABLE
,
MemoryMetricTable
.
COLUMN_ID
);
List
<
String
>
idList
=
new
ArrayList
<>();
long
timeBucket
=
startTimeBucket
;
do
{
// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1);
String
id
=
timeBucket
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
isHeap
;
idList
.
add
(
id
);
}
while
(
timeBucket
<=
endTimeBucket
);
@Override
public
Trend
getNoHeapMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
)
{
return
getMemoryTrend
(
instanceId
,
step
,
durationPoints
,
false
);
}
private
Trend
getMemoryTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
,
boolean
isHeap
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
MemoryMetricTable
.
TABLE
);
JsonObject
metric
=
new
JsonObjec
t
();
JsonArray
usedMetric
=
new
JsonArray
(
);
H2Client
client
=
getClien
t
();
String
sql
=
SqlBuilder
.
buildSql
(
GET_MEMORY_METRIC_SQL
,
tableName
,
MemoryMetricTable
.
COLUMN_ID
);
idList
.
forEach
(
id
->
{
Trend
trend
=
new
Trend
();
durationPoints
.
forEach
(
durationPoint
->
{
String
id
=
durationPoint
.
getPoint
()
+
Const
.
ID_SPLIT
+
instanceId
+
Const
.
ID_SPLIT
+
BooleanUtils
.
booleanToValue
(
isHeap
);
try
(
ResultSet
rs
=
client
.
executeQuery
(
sql
,
new
String
[]
{
id
}))
{
if
(
rs
.
next
())
{
metric
.
addProperty
(
"max"
,
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_MAX
));
metric
.
addProperty
(
"init"
,
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_INIT
));
usedMetric
.
add
(
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_USED
));
long
max
=
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_MAX
);
long
used
=
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_USED
);
long
times
=
rs
.
getLong
(
MemoryMetricTable
.
COLUMN_TIMES
);
trend
.
getMetrics
().
add
((
int
)(
used
/
times
));
trend
.
getMaxMetrics
().
add
((
int
)(
max
/
times
));
}
else
{
metric
.
addProperty
(
"max"
,
0
);
metric
.
addProperty
(
"init"
,
0
);
usedMetric
.
add
(
0
);
trend
.
getMetrics
().
add
(
0
);
trend
.
getMaxMetrics
().
add
(
0
);
}
}
catch
(
SQLException
|
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
});
metric
.
add
(
"used"
,
usedMetric
);
return
metric
;
return
trend
;
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
浏览文件 @
474e47c9
...
...
@@ -88,7 +88,9 @@ public class ServerQuery implements Query {
return
getServerService
().
getGCTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
}
public
MemoryTrend
getMemoryTrend
(
int
serverId
,
Duration
duration
)
{
return
null
;
public
MemoryTrend
getMemoryTrend
(
int
serverId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getMemoryTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceJVMService.java
浏览文件 @
474e47c9
...
...
@@ -78,9 +78,7 @@ public class InstanceJVMService {
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
tps
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
resptime
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
heapmemory
.
name
()))
{
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
true
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
nonheapmemory
.
name
()))
{
metrics
.
add
(
MetricType
.
nonheapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
false
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
permgen
.
name
()))
{
metrics
.
add
(
MetricType
.
permgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
timeBucket
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
metaspace
.
name
()))
{
...
...
@@ -107,9 +105,7 @@ public class InstanceJVMService {
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
tps
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
resptime
.
name
()))
{
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
heapmemory
.
name
()))
{
metrics
.
add
(
MetricType
.
heapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
true
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
nonheapmemory
.
name
()))
{
metrics
.
add
(
MetricType
.
nonheapmemory
.
name
(),
memoryMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
false
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
permgen
.
name
()))
{
metrics
.
add
(
MetricType
.
permgen
.
name
(),
memoryPoolMetricDAO
.
getMetric
(
instanceId
,
startTimeBucket
,
endTimeBucket
,
PoolType
.
PERMGEN_USAGE_VALUE
));
}
else
if
(
metricType
.
toLowerCase
().
equals
(
MetricType
.
metaspace
.
name
()))
{
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
浏览文件 @
474e47c9
...
...
@@ -32,12 +32,14 @@ import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO;
import
org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.ui.common.ThroughputTrend
;
import
org.apache.skywalking.apm.collector.storage.ui.server.AppServerInfo
;
import
org.apache.skywalking.apm.collector.storage.ui.server.CPUTrend
;
import
org.apache.skywalking.apm.collector.storage.ui.server.GCTrend
;
import
org.apache.skywalking.apm.collector.storage.ui.server.MemoryTrend
;
import
org.apache.skywalking.apm.collector.storage.utils.DurationPoint
;
import
org.apache.skywalking.apm.collector.ui.utils.DurationUtils
;
...
...
@@ -51,12 +53,14 @@ public class ServerService {
private
final
IInstanceMetricUIDAO
instanceMetricUIDAO
;
private
final
ICpuMetricUIDAO
cpuMetricUIDAO
;
private
final
IGCMetricUIDAO
gcMetricUIDAO
;
private
final
IMemoryMetricUIDAO
memoryMetricUIDAO
;
public
ServerService
(
ModuleManager
moduleManager
)
{
this
.
instanceUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceUIDAO
.
class
);
this
.
instanceMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceMetricUIDAO
.
class
);
this
.
cpuMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
ICpuMetricUIDAO
.
class
);
this
.
gcMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IGCMetricUIDAO
.
class
);
this
.
memoryMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IMemoryMetricUIDAO
.
class
);
}
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
,
long
end
)
{
...
...
@@ -112,6 +116,20 @@ public class ServerService {
return
gcTrend
;
}
public
MemoryTrend
getMemoryTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
MemoryTrend
memoryTrend
=
new
MemoryTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
IMemoryMetricUIDAO
.
Trend
heapMemoryTrend
=
memoryMetricUIDAO
.
getHeapMemoryTrend
(
instanceId
,
step
,
durationPoints
);
memoryTrend
.
setHeap
(
heapMemoryTrend
.
getMetrics
());
memoryTrend
.
setMaxHeap
(
heapMemoryTrend
.
getMaxMetrics
());
IMemoryMetricUIDAO
.
Trend
noHeapMemoryTrend
=
memoryMetricUIDAO
.
getNoHeapMemoryTrend
(
instanceId
,
step
,
durationPoints
);
memoryTrend
.
setNoheap
(
noHeapMemoryTrend
.
getMetrics
());
memoryTrend
.
setMaxNoheap
(
noHeapMemoryTrend
.
getMaxMetrics
());
return
memoryTrend
;
}
private
void
buildAppServerInfo
(
List
<
AppServerInfo
>
serverInfos
)
{
serverInfos
.
forEach
(
serverInfo
->
{
if
(
StringUtils
.
isNotEmpty
(
serverInfo
.
getOsInfo
()))
{
...
...
@@ -130,9 +148,7 @@ public class ServerService {
JsonArray
ipv4Array
=
osInfoJson
.
get
(
"ipv4s"
).
getAsJsonArray
();
List
<
String
>
ipv4s
=
new
LinkedList
<>();
ipv4Array
.
forEach
(
ipv4
->
{
ipv4s
.
add
(
ipv4
.
getAsString
());
});
ipv4Array
.
forEach
(
ipv4
->
ipv4s
.
add
(
ipv4
.
getAsString
()));
serverInfo
.
setIpv4
(
ipv4s
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录