Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
28d29117
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
28d29117
编写于
2月 28, 2018
作者:
wu-sheng
提交者:
GitHub
2月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into module/apm-backend-dist
上级
cfb64629
b76b3736
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
192 addition
and
257 deletion
+192
-257
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationComponentUIDAO.java
.../collector/storage/dao/ui/IApplicationComponentUIDAO.java
+1
-1
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationMappingUIDAO.java
...pm/collector/storage/dao/ui/IApplicationMappingUIDAO.java
+1
-1
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationReferenceMetricUIDAO.java
...ctor/storage/dao/ui/IApplicationReferenceMetricUIDAO.java
+2
-7
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceMetricUIDAO.java
...ng/apm/collector/storage/dao/ui/IInstanceMetricUIDAO.java
+2
-3
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceUIDAO.java
...ywalking/apm/collector/storage/dao/ui/IInstanceUIDAO.java
+1
-1
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/AppServerInfo.java
...alking/apm/collector/storage/ui/server/AppServerInfo.java
+5
-5
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationComponentEsUIDAO.java
...lector/storage/es/dao/ui/ApplicationComponentEsUIDAO.java
+3
-3
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationMappingEsUIDAO.java
...ollector/storage/es/dao/ui/ApplicationMappingEsUIDAO.java
+2
-2
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationReferenceMetricEsUIDAO.java
.../storage/es/dao/ui/ApplicationReferenceMetricEsUIDAO.java
+14
-42
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceEsUIDAO.java
...king/apm/collector/storage/es/dao/ui/InstanceEsUIDAO.java
+18
-7
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceMetricEsUIDAO.java
...pm/collector/storage/es/dao/ui/InstanceMetricEsUIDAO.java
+4
-4
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationComponentH2UIDAO.java
...lector/storage/h2/dao/ui/ApplicationComponentH2UIDAO.java
+2
-2
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationMappingH2UIDAO.java
...ollector/storage/h2/dao/ui/ApplicationMappingH2UIDAO.java
+2
-2
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationReferenceMetricH2UIDAO.java
.../storage/h2/dao/ui/ApplicationReferenceMetricH2UIDAO.java
+2
-44
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceH2UIDAO.java
...king/apm/collector/storage/h2/dao/ui/InstanceH2UIDAO.java
+10
-8
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceMetricH2UIDAO.java
...pm/collector/storage/h2/dao/ui/InstanceMetricH2UIDAO.java
+2
-2
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java
...e/skywalking/apm/collector/ui/query/ApplicationQuery.java
+18
-9
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
+21
-21
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java
...ywalking/apm/collector/ui/service/ApplicationService.java
+18
-6
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationTopologyService.java
.../apm/collector/ui/service/ApplicationTopologyService.java
+24
-61
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
+25
-19
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java
...ache/skywalking/apm/collector/ui/utils/DurationUtils.java
+5
-5
apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls
...tocol/src/main/resources/ui-graphql/server-layer.graphqls
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/DiscoveryRestServiceClient.java
...ing/apm/agent/core/remote/DiscoveryRestServiceClient.java
+9
-1
未找到文件。
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationComponentUIDAO.java
浏览文件 @
28d29117
...
...
@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.collector.storage.ui.common.Step;
*/
public
interface
IApplicationComponentUIDAO
extends
DAO
{
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
,
long
endTime
);
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
);
class
ApplicationComponent
{
private
int
componentId
;
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationMappingUIDAO.java
浏览文件 @
28d29117
...
...
@@ -26,7 +26,7 @@ import org.apache.skywalking.apm.collector.storage.ui.common.Step;
* @author peng-yongsheng
*/
public
interface
IApplicationMappingUIDAO
extends
DAO
{
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
,
long
endTime
);
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
);
class
ApplicationMapping
{
private
int
applicationId
;
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationReferenceMetricUIDAO.java
浏览文件 @
28d29117
...
...
@@ -27,14 +27,9 @@ import org.apache.skywalking.apm.collector.storage.ui.common.Step;
* @author peng-yongsheng
*/
public
interface
IApplicationReferenceMetricUIDAO
extends
DAO
{
List
<
ApplicationReferenceMetric
>
getFrontApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
);
List
<
ApplicationReferenceMetric
>
getBehindApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
);
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
);
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
MetricSource
metricSource
,
Integer
...
applicationIds
);
class
ApplicationReferenceMetric
{
private
int
source
;
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceMetricUIDAO.java
浏览文件 @
28d29117
...
...
@@ -30,9 +30,8 @@ import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
*/
public
interface
IInstanceMetricUIDAO
extends
DAO
{
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
,
long
end
,
long
secondBetween
,
int
topN
,
MetricSource
metricSource
);
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
int
secondBetween
,
int
topN
,
MetricSource
metricSource
);
List
<
Integer
>
getServerTPSTrend
(
int
instanceId
,
Step
step
,
List
<
DurationPoint
>
durationPoints
);
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceUIDAO.java
浏览文件 @
28d29117
...
...
@@ -36,7 +36,7 @@ public interface IInstanceUIDAO extends DAO {
Instance
getInstance
(
int
instanceId
);
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
,
long
end
);
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
SecondTimeBucket
,
long
endSecondTimeBucket
);
List
<
AppServerInfo
>
getAllServer
(
int
applicationId
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
);
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/AppServerInfo.java
浏览文件 @
28d29117
...
...
@@ -29,7 +29,7 @@ public class AppServerInfo {
private
String
applicationCode
;
private
String
osInfo
;
private
String
name
;
private
int
tps
;
private
int
callsPerSec
;
private
String
host
;
private
int
pid
;
private
List
<
String
>
ipv4
;
...
...
@@ -74,12 +74,12 @@ public class AppServerInfo {
this
.
name
=
name
;
}
public
int
get
Tps
()
{
return
tps
;
public
int
get
CallsPerSec
()
{
return
callsPerSec
;
}
public
void
set
Tps
(
int
tps
)
{
this
.
tps
=
tps
;
public
void
set
CallsPerSec
(
int
callsPerSec
)
{
this
.
callsPerSec
=
callsPerSec
;
}
public
String
getHost
()
{
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationComponentEsUIDAO.java
浏览文件 @
28d29117
...
...
@@ -46,13 +46,13 @@ public class ApplicationComponentEsUIDAO extends EsDAO implements IApplicationCo
super
(
client
);
}
@Override
public
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
,
long
endTime
)
{
logger
.
debug
(
"application component load, start time: {}, end time: {}"
,
startTime
,
endTime
);
@Override
public
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
)
{
logger
.
debug
(
"application component load, start time: {}, end time: {}"
,
startTime
Bucket
,
endTimeBucket
);
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationComponentTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
searchRequestBuilder
.
setTypes
(
ApplicationComponentTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
rangeQuery
(
ApplicationComponentTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
).
lte
(
endTime
));
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
rangeQuery
(
ApplicationComponentTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
Bucket
).
lte
(
endTimeBucket
));
searchRequestBuilder
.
setSize
(
0
);
searchRequestBuilder
.
addAggregation
(
AggregationBuilders
.
terms
(
ApplicationComponentTable
.
COLUMN_COMPONENT_ID
).
field
(
ApplicationComponentTable
.
COLUMN_COMPONENT_ID
).
size
(
100
)
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationMappingEsUIDAO.java
浏览文件 @
28d29117
...
...
@@ -46,13 +46,13 @@ public class ApplicationMappingEsUIDAO extends EsDAO implements IApplicationMapp
super
(
client
);
}
@Override
public
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
,
long
endTime
)
{
@Override
public
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationMappingTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
searchRequestBuilder
.
setTypes
(
ApplicationMappingTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
rangeQuery
(
ApplicationMappingTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
).
lte
(
endTime
));
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
rangeQuery
(
ApplicationMappingTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
Bucket
).
lte
(
endTimeBucket
));
searchRequestBuilder
.
setSize
(
0
);
searchRequestBuilder
.
addAggregation
(
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationReferenceMetricEsUIDAO.java
浏览文件 @
28d29117
...
...
@@ -21,6 +21,7 @@ package org.apache.skywalking.apm.collector.storage.es.dao.ui;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.apache.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationReferenceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO
;
import
org.apache.skywalking.apm.collector.storage.table.MetricSource
;
...
...
@@ -46,9 +47,8 @@ public class ApplicationReferenceMetricEsUIDAO extends EsDAO implements IApplica
super
(
client
);
}
@Override
public
List
<
ApplicationReferenceMetric
>
getFrontApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
@Override
public
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
MetricSource
metricSource
,
Integer
...
applicationIds
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationReferenceMetricTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
...
...
@@ -56,48 +56,20 @@ public class ApplicationReferenceMetricEsUIDAO extends EsDAO implements IApplica
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
ApplicationReferenceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
).
lte
(
endTime
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
ApplicationReferenceMetricTable
.
COLUMN_BEHIND_APPLICATION_ID
,
applicationId
));
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
ApplicationReferenceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTimeBucket
).
lte
(
endTimeBucket
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
ApplicationReferenceMetricTable
.
COLUMN_SOURCE_VALUE
,
metricSource
.
getValue
()));
searchRequestBuilder
.
setQuery
(
boolQuery
);
searchRequestBuilder
.
setSize
(
0
);
return
buildMetrics
(
searchRequestBuilder
);
}
@Override
public
List
<
ApplicationReferenceMetric
>
getBehindApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationReferenceMetricTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
searchRequestBuilder
.
setTypes
(
ApplicationReferenceMetricTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
ApplicationReferenceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
).
lte
(
endTime
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
ApplicationReferenceMetricTable
.
COLUMN_FRONT_APPLICATION_ID
,
applicationId
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
ApplicationReferenceMetricTable
.
COLUMN_SOURCE_VALUE
,
metricSource
.
getValue
()));
searchRequestBuilder
.
setQuery
(
boolQuery
);
searchRequestBuilder
.
setSize
(
0
);
return
buildMetrics
(
searchRequestBuilder
);
}
@Override
public
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationReferenceMetricTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
searchRequestBuilder
.
setTypes
(
ApplicationReferenceMetricTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
if
(
CollectionUtils
.
isNotEmpty
(
applicationIds
))
{
BoolQueryBuilder
applicationBoolQuery
=
QueryBuilders
.
boolQuery
();
int
[]
ids
=
new
int
[
applicationIds
.
length
];
for
(
int
i
=
0
;
i
<
applicationIds
.
length
;
i
++)
{
ids
[
i
]
=
applicationIds
[
i
];
}
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
ApplicationReferenceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
startTime
).
lte
(
endTime
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
ApplicationReferenceMetricTable
.
COLUMN_SOURCE_VALUE
,
metricSource
.
getValue
()));
applicationBoolQuery
.
should
().
add
(
QueryBuilders
.
termsQuery
(
ApplicationReferenceMetricTable
.
COLUMN_FRONT_APPLICATION_ID
,
ids
));
applicationBoolQuery
.
should
().
add
(
QueryBuilders
.
termsQuery
(
ApplicationReferenceMetricTable
.
COLUMN_BEHIND_APPLICATION_ID
,
ids
));
boolQuery
.
must
().
add
(
applicationBoolQuery
);
}
searchRequestBuilder
.
setQuery
(
boolQuery
);
searchRequestBuilder
.
setSize
(
0
);
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceEsUIDAO.java
浏览文件 @
28d29117
...
...
@@ -97,7 +97,8 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO {
return
heartBeatTime
;
}
@Override
public
List
<
Application
>
getApplications
(
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
int
...
applicationIds
)
{
@Override
public
List
<
Application
>
getApplications
(
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
int
...
applicationIds
)
{
logger
.
debug
(
"application list get, start time: {}, end time: {}"
,
startSecondTimeBucket
,
endSecondTimeBucket
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
InstanceTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
InstanceTable
.
TABLE_TYPE
);
...
...
@@ -150,19 +151,26 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO {
return
null
;
}
@Override
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
,
long
end
)
{
logger
.
debug
(
"get instances info, keyword: {}, start: {}, end: {}"
,
keyword
,
start
,
end
);
@Override
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
{
logger
.
debug
(
"get instances info, keyword: {}, start: {}, end: {}"
,
keyword
,
startSecondTimeBucket
,
endSecondTimeBucket
);
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
(
start
).
lte
(
end
));
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
boolQuery
.
must
().
add
(
QueryBuilders
.
queryStringQuery
(
keyword
));
}
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstanceTable
.
COLUMN_IS_ADDRESS
,
BooleanUtils
.
FALSE
));
BoolQueryBuilder
timeBoolQuery
=
QueryBuilders
.
boolQuery
();
timeBoolQuery
.
should
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_REGISTER_TIME
).
gte
(
startSecondTimeBucket
).
lte
(
endSecondTimeBucket
));
timeBoolQuery
.
should
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gte
(
startSecondTimeBucket
).
lte
(
endSecondTimeBucket
));
boolQuery
.
must
().
add
(
timeBoolQuery
);
searchRequestBuilder
.
setQuery
(
boolQuery
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
...
...
@@ -180,11 +188,14 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO {
searchRequestBuilder
.
setSize
(
1000
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_REGISTER_TIME
).
gte
(
startSecondTimeBucket
).
lte
(
endSecondTimeBucket
));
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gte
(
startSecondTimeBucket
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstanceTable
.
COLUMN_APPLICATION_ID
,
applicationId
));
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstanceTable
.
COLUMN_IS_ADDRESS
,
BooleanUtils
.
FALSE
));
BoolQueryBuilder
timeBoolQuery
=
QueryBuilders
.
boolQuery
();
timeBoolQuery
.
should
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_REGISTER_TIME
).
gte
(
startSecondTimeBucket
).
lte
(
endSecondTimeBucket
));
timeBoolQuery
.
should
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
).
gte
(
startSecondTimeBucket
).
lte
(
endSecondTimeBucket
));
boolQuery
.
must
().
add
(
timeBoolQuery
);
searchRequestBuilder
.
setQuery
(
boolQuery
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceMetricEsUIDAO.java
浏览文件 @
28d29117
...
...
@@ -58,8 +58,8 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO
super
(
client
);
}
@Override
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
,
long
end
,
long
secondBetween
,
int
topN
,
MetricSource
metricSource
)
{
@Override
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
TimeBucket
,
long
endTimeBucket
,
int
secondBetween
,
int
topN
,
MetricSource
metricSource
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
InstanceMetricTable
.
TABLE
);
SearchRequestBuilder
searchRequestBuilder
=
getClient
().
prepareSearch
(
tableName
);
...
...
@@ -67,7 +67,7 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO
searchRequestBuilder
.
setSearchType
(
SearchType
.
DFS_QUERY_THEN_FETCH
);
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
start
).
lte
(
end
));
boolQuery
.
must
().
add
(
QueryBuilders
.
rangeQuery
(
InstanceMetricTable
.
COLUMN_TIME_BUCKET
).
gte
(
start
TimeBucket
).
lte
(
endTimeBucket
));
if
(
applicationId
!=
0
)
{
boolQuery
.
must
().
add
(
QueryBuilders
.
termQuery
(
InstanceMetricTable
.
COLUMN_APPLICATION_ID
,
applicationId
));
}
...
...
@@ -102,7 +102,7 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO
InternalSimpleValue
simpleValue
=
serviceIdTerm
.
getAggregations
().
get
(
AVG_TPS
);
appServerInfo
.
setId
(
instanceId
);
appServerInfo
.
set
Tps
((
int
)
simpleValue
.
getValue
());
appServerInfo
.
set
CallsPerSec
((
int
)
simpleValue
.
getValue
());
appServerInfos
.
add
(
appServerInfo
);
});
return
appServerInfos
;
...
...
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationComponentH2UIDAO.java
浏览文件 @
28d29117
...
...
@@ -45,7 +45,7 @@ public class ApplicationComponentH2UIDAO extends H2DAO implements IApplicationCo
super
(
client
);
}
@Override
public
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
,
long
endTime
)
{
@Override
public
List
<
ApplicationComponent
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
)
{
H2Client
client
=
getClient
();
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationComponentTable
.
TABLE
);
...
...
@@ -54,7 +54,7 @@ public class ApplicationComponentH2UIDAO extends H2DAO implements IApplicationCo
String
sql
=
SqlBuilder
.
buildSql
(
AGGREGATE_COMPONENT_SQL
,
ApplicationComponentTable
.
COLUMN_COMPONENT_ID
,
ApplicationComponentTable
.
COLUMN_APPLICATION_ID
,
tableName
,
ApplicationComponentTable
.
COLUMN_TIME_BUCKET
);
Object
[]
params
=
new
Object
[]
{
startTime
,
endTime
};
Object
[]
params
=
new
Object
[]
{
startTime
Bucket
,
endTimeBucket
};
try
(
ResultSet
rs
=
client
.
executeQuery
(
sql
,
params
))
{
while
(
rs
.
next
())
{
int
applicationId
=
rs
.
getInt
(
ApplicationComponentTable
.
COLUMN_APPLICATION_ID
);
...
...
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationMappingH2UIDAO.java
浏览文件 @
28d29117
...
...
@@ -45,7 +45,7 @@ public class ApplicationMappingH2UIDAO extends H2DAO implements IApplicationMapp
super
(
client
);
}
@Override
public
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
,
long
endTime
)
{
@Override
public
List
<
ApplicationMapping
>
load
(
Step
step
,
long
startTime
Bucket
,
long
endTimeBucket
)
{
String
tableName
=
TimePyramidTableNameBuilder
.
build
(
step
,
ApplicationMappingTable
.
TABLE
);
H2Client
client
=
getClient
();
...
...
@@ -53,7 +53,7 @@ public class ApplicationMappingH2UIDAO extends H2DAO implements IApplicationMapp
ApplicationMappingTable
.
COLUMN_MAPPING_APPLICATION_ID
,
tableName
,
ApplicationMappingTable
.
COLUMN_TIME_BUCKET
);
List
<
ApplicationMapping
>
applicationMappings
=
new
LinkedList
<>();
Object
[]
params
=
new
Object
[]
{
startTime
,
endTime
};
Object
[]
params
=
new
Object
[]
{
startTime
Bucket
,
endTimeBucket
};
try
(
ResultSet
rs
=
client
.
executeQuery
(
sql
,
params
))
{
while
(
rs
.
next
())
{
int
applicationId
=
rs
.
getInt
(
ApplicationMappingTable
.
COLUMN_APPLICATION_ID
);
...
...
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationReferenceMetricH2UIDAO.java
浏览文件 @
28d29117
...
...
@@ -18,7 +18,6 @@
package
org.apache.skywalking.apm.collector.storage.h2.dao.ui
;
import
com.google.gson.JsonArray
;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationReferenceMetricUIDAO
;
...
...
@@ -41,49 +40,8 @@ public class ApplicationReferenceMetricH2UIDAO extends H2DAO implements IApplica
super
(
client
);
}
@Override
public
List
<
ApplicationReferenceMetric
>
getFrontApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
H2Client
client
=
getClient
();
JsonArray
applicationReferenceMetricArray
=
new
JsonArray
();
// String sql = SqlBuilder.buildSql(APPLICATION_REFERENCE_SQL, ApplicationReferenceMetricTable.COLUMN_S1_LTE,
// ApplicationReferenceMetricTable.COLUMN_S3_LTE, ApplicationReferenceMetricTable.COLUMN_S5_LTE,
// ApplicationReferenceMetricTable.COLUMN_S5_GT, ApplicationReferenceMetricTable.COLUMN_SUMMARY,
// ApplicationReferenceMetricTable.COLUMN_ERROR, ApplicationReferenceMetricTable.TABLE, ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET,
// ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID);
//
// Object[] params = new Object[] {startTime, endTime};
// try (ResultSet rs = client.executeQuery(sql, params)) {
// while (rs.next()) {
// int frontApplicationId = rs.getInt(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID);
// int behindApplicationId = rs.getInt(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID);
// JsonObject nodeRefResSumObj = new JsonObject();
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID), frontApplicationId);
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID), behindApplicationId);
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S1_LTE), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_S1_LTE));
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S3_LTE), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_S3_LTE));
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S5_LTE), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_S5_LTE));
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S5_GT), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_S5_GT));
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_ERROR), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_ERROR));
// nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_SUMMARY), rs.getDouble(ApplicationReferenceMetricTable.COLUMN_SUMMARY));
// nodeRefResSumArray.add(nodeRefResSumObj);
// }
// } catch (SQLException | H2ClientException e) {
// logger.error(e.getMessage(), e);
// }
return
null
;
}
@Override
public
List
<
ApplicationReferenceMetric
>
getBehindApplications
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
return
null
;
}
@Override
public
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTime
,
long
endTime
,
MetricSource
metricSource
)
{
@Override
public
List
<
ApplicationReferenceMetric
>
getReferences
(
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
MetricSource
metricSource
,
Integer
...
applicationIds
)
{
return
null
;
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceH2UIDAO.java
浏览文件 @
28d29117
...
...
@@ -88,7 +88,8 @@ public class InstanceH2UIDAO extends H2DAO implements IInstanceUIDAO {
}
@Override
public
List
<
Application
>
getApplications
(
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
int
...
applicationIds
)
{
public
List
<
Application
>
getApplications
(
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
int
...
applicationIds
)
{
H2Client
client
=
getClient
();
List
<
Application
>
applications
=
new
LinkedList
<>();
String
sql
=
SqlBuilder
.
buildSql
(
GET_APPLICATIONS_SQL
,
InstanceTable
.
COLUMN_INSTANCE_ID
,
...
...
@@ -131,20 +132,21 @@ public class InstanceH2UIDAO extends H2DAO implements IInstanceUIDAO {
return
null
;
}
@Override
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
,
long
end
)
{
logger
.
debug
(
"get instances info, keyword: {}, start: {}, end: {}"
,
keyword
,
start
,
end
);
String
dynamicSql
=
"select * from {0} where {1} like ? and {2} >= ? and {2} <= ? and {3} = ?"
;
String
sql
=
SqlBuilder
.
buildSql
(
dynamicSql
,
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_OS_INFO
,
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
InstanceTable
.
COLUMN_IS_ADDRESS
);
Object
[]
params
=
new
Object
[]
{
keyword
,
start
,
end
,
BooleanUtils
.
FALSE
};
@Override
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
{
logger
.
debug
(
"get instances info, keyword: {}, start: {}, end: {}"
,
keyword
,
startSecondTimeBucket
,
endSecondTimeBucket
);
String
dynamicSql
=
"select * from {0} where {1} like ? and (({2} >= ? and {2} <= ?) or ({3} >= ? and {3} <= ?)) and {4} = ?"
;
String
sql
=
SqlBuilder
.
buildSql
(
dynamicSql
,
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_OS_INFO
,
InstanceTable
.
COLUMN_REGISTER_TIME
,
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
InstanceTable
.
COLUMN_IS_ADDRESS
);
Object
[]
params
=
new
Object
[]
{
keyword
,
startSecondTimeBucket
,
endSecondTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
,
BooleanUtils
.
FALSE
};
return
buildAppServerInfo
(
sql
,
params
);
}
@Override
public
List
<
AppServerInfo
>
getAllServer
(
int
applicationId
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
{
logger
.
debug
(
"get instances info, applicationId: {}, startSecondTimeBucket: {}, endSecondTimeBucket: {}"
,
applicationId
,
startSecondTimeBucket
,
endSecondTimeBucket
);
String
dynamicSql
=
"select * from {0} where {1} = ? and
{2} >= ? and {2} <= ? and {3} >= ?
and {4} = ?"
;
String
dynamicSql
=
"select * from {0} where {1} = ? and
(({2} >= ? and {2} <= ?) or ({3} >= ? and {3} <= ?))
and {4} = ?"
;
String
sql
=
SqlBuilder
.
buildSql
(
dynamicSql
,
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_APPLICATION_ID
,
InstanceTable
.
COLUMN_REGISTER_TIME
,
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
InstanceTable
.
COLUMN_IS_ADDRESS
);
Object
[]
params
=
new
Object
[]
{
applicationId
,
startSecondTimeBucket
,
endSecondTimeBucket
,
startSecondTimeBucket
,
BooleanUtils
.
FALSE
};
Object
[]
params
=
new
Object
[]
{
applicationId
,
startSecondTimeBucket
,
endSecondTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
,
BooleanUtils
.
FALSE
};
return
buildAppServerInfo
(
sql
,
params
);
}
...
...
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceMetricH2UIDAO.java
浏览文件 @
28d29117
...
...
@@ -49,8 +49,8 @@ public class InstanceMetricH2UIDAO extends H2DAO implements IInstanceMetricUIDAO
super
(
client
);
}
@Override
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
,
long
end
,
long
secondBetween
,
int
topN
,
MetricSource
metricSource
)
{
@Override
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
TimeBucket
,
long
endTimeBucket
,
int
secondBetween
,
int
topN
,
MetricSource
metricSource
)
{
return
null
;
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java
浏览文件 @
28d29117
...
...
@@ -76,25 +76,34 @@ public class ApplicationQuery implements Query {
}
public
Topology
getApplicationTopology
(
int
applicationId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getApplicationTopologyService
().
getApplicationTopology
(
duration
.
getStep
(),
applicationId
,
start
,
end
);
long
startSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
endSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getApplicationTopologyService
().
getApplicationTopology
(
duration
.
getStep
(),
applicationId
,
startTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
}
public
List
<
ServiceMetric
>
getSlowService
(
int
applicationId
,
Duration
duration
,
Integer
topN
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getApplicationService
().
getSlowService
(
applicationId
,
duration
.
getStep
(),
start
,
end
,
topN
);
long
startSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
endSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getApplicationService
().
getSlowService
(
applicationId
,
duration
.
getStep
(),
startTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
,
topN
);
}
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Duration
duration
,
Integer
topN
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
long
startTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
endTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
long
startSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
endSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getServerService
().
getServerThroughput
(
applicationId
,
duration
.
getStep
(),
start
,
end
,
topN
);
return
getServerService
().
getServerThroughput
(
applicationId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
,
topN
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
浏览文件 @
28d29117
...
...
@@ -53,44 +53,44 @@ public class ServerQuery implements Query {
}
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getServerService
().
searchServer
(
keyword
,
start
,
end
);
long
start
SecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
end
SecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getServerService
().
searchServer
(
keyword
,
start
SecondTimeBucket
,
endSecondTimeBucket
);
}
public
List
<
AppServerInfo
>
getAllServer
(
int
applicationId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getServerService
().
getAllServer
(
applicationId
,
start
,
end
);
long
start
SecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getStart
());
long
end
SecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
duration
.
getStep
(),
duration
.
getEnd
());
return
getServerService
().
getAllServer
(
applicationId
,
start
SecondTimeBucket
,
endSecondTimeBucket
);
}
public
ResponseTimeTrend
getServerResponseTimeTrend
(
int
serverId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getServerResponseTimeTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getServerResponseTimeTrend
(
serverId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
);
}
public
ThroughputTrend
getServerTPSTrend
(
int
serverId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getServerTPSTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getServerTPSTrend
(
serverId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
);
}
public
CPUTrend
getCPUTrend
(
int
serverId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getCPUTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getCPUTrend
(
serverId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
);
}
public
GCTrend
getGCTrend
(
int
serverId
,
Duration
duration
)
throws
ParseException
{
long
start
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getGCTrend
(
serverId
,
duration
.
getStep
(),
start
,
end
);
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getGCTrend
(
serverId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
);
}
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
);
long
start
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
end
TimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getServerService
().
getMemoryTrend
(
serverId
,
duration
.
getStep
(),
start
TimeBucket
,
endTimeBucket
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java
浏览文件 @
28d29117
...
...
@@ -32,6 +32,7 @@ import org.apache.skywalking.apm.collector.storage.dao.ui.INetworkAddressUIDAO;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.table.MetricSource
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServerTypeDefine
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServiceName
;
import
org.apache.skywalking.apm.collector.storage.ui.application.Application
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.ui.overview.ApplicationTPS
;
...
...
@@ -39,18 +40,23 @@ import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp;
import
org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief
;
import
org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric
;
import
org.apache.skywalking.apm.collector.ui.utils.DurationUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
ApplicationService
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationService
.
class
);
private
final
IInstanceUIDAO
instanceDAO
;
private
final
IServiceMetricUIDAO
serviceMetricUIDAO
;
private
final
IApplicationMetricUIDAO
applicationMetricUIDAO
;
private
final
INetworkAddressUIDAO
networkAddressUIDAO
;
private
final
ApplicationCacheService
applicationCacheService
;
private
final
ServiceNameCacheService
serviceNameCacheService
;
private
final
SecondBetweenService
secondBetweenService
;
public
ApplicationService
(
ModuleManager
moduleManager
)
{
this
.
instanceDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceUIDAO
.
class
);
...
...
@@ -59,6 +65,7 @@ public class ApplicationService {
this
.
networkAddressUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
INetworkAddressUIDAO
.
class
);
this
.
applicationCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ApplicationCacheService
.
class
);
this
.
serviceNameCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ServiceNameCacheService
.
class
);
this
.
secondBetweenService
=
new
SecondBetweenService
(
moduleManager
);
}
public
List
<
Application
>
getApplications
(
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
...
...
@@ -78,13 +85,18 @@ public class ApplicationService {
return
applications
;
}
public
List
<
ServiceMetric
>
getSlowService
(
int
applicationId
,
Step
step
,
long
start
,
long
end
,
Integer
top
)
throws
ParseException
{
List
<
ServiceMetric
>
slowServices
=
serviceMetricUIDAO
.
getSlowService
(
applicationId
,
step
,
start
,
end
,
top
,
MetricSource
.
Callee
);
public
List
<
ServiceMetric
>
getSlowService
(
int
applicationId
,
Step
step
,
long
start
TimeBucket
,
long
endTimeBucket
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
Integer
topN
)
throws
ParseException
{
List
<
ServiceMetric
>
slowServices
=
serviceMetricUIDAO
.
getSlowService
(
applicationId
,
step
,
start
TimeBucket
,
endTimeBucket
,
topN
,
MetricSource
.
Callee
);
slowServices
.
forEach
(
slowService
->
{
slowService
.
setName
(
serviceNameCacheService
.
get
(
slowService
.
getId
()).
getServiceName
());
//TODO
slowService
.
setCallsPerSec
(
1
);
ServiceName
serviceName
=
serviceNameCacheService
.
get
(
slowService
.
getId
());
try
{
slowService
.
setCallsPerSec
((
int
)(
slowService
.
getCalls
()
/
secondBetweenService
.
calculate
(
serviceName
.
getApplicationId
(),
startSecondTimeBucket
,
endSecondTimeBucket
)));
}
catch
(
ParseException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
slowService
.
setName
(
serviceName
.
getServiceName
());
});
return
slowServices
;
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationTopologyService.java
浏览文件 @
28d29117
...
...
@@ -20,13 +20,17 @@ package org.apache.skywalking.apm.collector.ui.service;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.skywalking.apm.collector.core.module.ModuleManager
;
import
org.apache.skywalking.apm.collector.storage.StorageModule
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationComponentUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationReferenceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.table.MetricSource
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Step
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Topology
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
...
...
@@ -42,6 +46,7 @@ public class ApplicationTopologyService {
private
final
IApplicationComponentUIDAO
applicationComponentUIDAO
;
private
final
IApplicationMappingUIDAO
applicationMappingUIDAO
;
private
final
IApplicationMetricUIDAO
applicationMetricUIDAO
;
private
final
IApplicationReferenceMetricUIDAO
applicationReferenceMetricUIDAO
;
private
final
ModuleManager
moduleManager
;
...
...
@@ -49,76 +54,34 @@ public class ApplicationTopologyService {
this
.
moduleManager
=
moduleManager
;
this
.
applicationComponentUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationComponentUIDAO
.
class
);
this
.
applicationMappingUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationMappingUIDAO
.
class
);
this
.
applicationMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationMetricUIDAO
.
class
);
this
.
applicationReferenceMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationReferenceMetricUIDAO
.
class
);
}
public
Topology
getApplicationTopology
(
Step
step
,
int
applicationId
,
long
startTime
,
long
endTime
)
throws
ParseException
{
logger
.
debug
(
"startTime: {}, endTime: {}"
,
startTime
,
endTime
);
List
<
IApplicationComponentUIDAO
.
ApplicationComponent
>
applicationComponents
=
applicationComponentUIDAO
.
load
(
step
,
startTime
,
endTime
);
List
<
IApplicationMappingUIDAO
.
ApplicationMapping
>
applicationMappings
=
applicationMappingUIDAO
.
load
(
step
,
startTime
,
endTime
);
public
Topology
getApplicationTopology
(
Step
step
,
int
applicationId
,
long
startTimeBucket
,
long
endTimeBucket
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
throws
ParseException
{
logger
.
debug
(
"startTime: {}, endTime: {}"
,
startTimeBucket
,
endTimeBucket
);
List
<
IApplicationComponentUIDAO
.
ApplicationComponent
>
applicationComponents
=
applicationComponentUIDAO
.
load
(
step
,
startTimeBucket
,
endTimeBucket
);
List
<
IApplicationMappingUIDAO
.
ApplicationMapping
>
applicationMappings
=
applicationMappingUIDAO
.
load
(
step
,
startTimeBucket
,
endTimeBucket
);
Set
<
Integer
>
applicationIds
=
new
HashSet
<>();
applicationIds
.
add
(
applicationId
);
applicationMappings
.
forEach
(
mapping
->
{
if
(
mapping
.
getApplicationId
()
==
applicationId
)
{
applicationIds
.
add
(
mapping
.
getMappingApplicationId
());
}
});
Map
<
Integer
,
String
>
components
=
new
HashMap
<>();
applicationComponents
.
forEach
(
component
->
components
.
put
(
component
.
getApplicationId
(),
ComponentsDefine
.
getInstance
().
getComponentName
(
component
.
getComponentId
())));
// List<Call> callerCalls = applicationReferenceMetricUIDAO.getFrontApplications(step, applicationId, startTime, endTime, MetricSource.Caller);
// callerCalls.addAll(applicationReferenceMetricUIDAO.getBehindApplications(step, applicationId, startTime, endTime, MetricSource.Caller));
//
// callerCalls.forEach(callerCall -> callerCall.setCallType(components.get(callerCall.getTarget())));
//
// List<Call> calleeCalls = applicationReferenceMetricUIDAO.getFrontApplications(step, applicationId, startTime, endTime, MetricSource.Callee);
// calleeCalls.addAll(applicationReferenceMetricUIDAO.getBehindApplications(step, applicationId, startTime, endTime, MetricSource.Callee));
//
// calleeCalls.forEach(calleeCall -> calleeCall.setCallType(components.get(calleeCall.getTarget())));
//
// Set<Integer> mappings = new HashSet<>();
// applicationMappings.forEach(mapping -> {
// if (applicationId == mapping.getApplicationId()) {
// mappings.add(mapping.getMappingApplicationId());
// }
// });
//
// mappings.forEach(mappingApplicationId -> {
// List<Call> frontCallerApplications = applicationReferenceMetricUIDAO.getFrontApplications(step, mappingApplicationId, startTime, endTime, MetricSource.Caller);
// frontCallerApplications.forEach(call -> {
// call.setCallType(components.get(call.getTarget()));
// call.setTarget(applicationId);
// callerCalls.add(call);
// });
//
// List<Call> behindCallerApplications = applicationReferenceMetricUIDAO.getBehindApplications(step, mappingApplicationId, startTime, endTime, MetricSource.Caller);
// behindCallerApplications.forEach(call -> {
// call.setCallType(components.get(call.getTarget()));
// call.setSource(applicationId);
// callerCalls.add(call);
// });
//
// List<Call> frontCalleeApplications = applicationReferenceMetricUIDAO.getFrontApplications(step, mappingApplicationId, startTime, endTime, MetricSource.Callee);
// frontCalleeApplications.forEach(call -> {
// call.setCallType(components.get(call.getTarget()));
// call.setTarget(applicationId);
// calleeCalls.add(call);
// });
//
// List<Call> behindCalleeApplications = applicationReferenceMetricUIDAO.getBehindApplications(step, mappingApplicationId, startTime, endTime, MetricSource.Callee);
// behindCalleeApplications.forEach(call -> {
// call.setCallType(components.get(call.getTarget()));
// call.setSource(applicationId);
// calleeCalls.add(call);
// });
// });
List
<
IApplicationMetricUIDAO
.
ApplicationMetric
>
applicationMetrics
=
applicationMetricUIDAO
.
getApplications
(
step
,
startTimeBucket
,
endTimeBucket
,
MetricSource
.
Callee
);
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
callerReferenceMetric
=
applicationReferenceMetricUIDAO
.
getReferences
(
step
,
startTimeBucket
,
endTimeBucket
,
MetricSource
.
Caller
,
applicationIds
.
toArray
(
new
Integer
[
0
]));
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
calleeReferenceMetric
=
applicationReferenceMetricUIDAO
.
getReferences
(
step
,
startTimeBucket
,
endTimeBucket
,
MetricSource
.
Callee
,
applicationIds
.
toArray
(
new
Integer
[
0
]));
TopologyBuilder
builder
=
new
TopologyBuilder
(
moduleManager
);
// long secondsBetween = DurationUtils.INSTANCE.secondsBetween(step, startTime, endTime);
// Topology topology = builder.build(applicationComponents, applicationMappings, callerCalls, calleeCalls, secondsBetween);
//
// topology.getCalls().forEach(call -> {
// long calls = call.getCalls();
// long responseTimes = call.getResponseTimes();
// call.setCallsPerSec(calls / secondsBetween);
// call.setAvgResponseTime(responseTimes / secondsBetween);
// });
return
null
;
return
builder
.
build
(
applicationComponents
,
applicationMappings
,
applicationMetrics
,
callerReferenceMetric
,
calleeReferenceMetric
,
startSecondTimeBucket
,
endSecondTimeBucket
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
浏览文件 @
28d29117
...
...
@@ -61,6 +61,7 @@ public class ServerService {
private
final
IMemoryMetricUIDAO
memoryMetricUIDAO
;
private
final
InstanceCacheService
instanceCacheService
;
private
final
ApplicationCacheService
applicationCacheService
;
private
final
SecondBetweenService
secondBetweenService
;
public
ServerService
(
ModuleManager
moduleManager
)
{
this
.
instanceUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceUIDAO
.
class
);
...
...
@@ -70,10 +71,11 @@ public class ServerService {
this
.
memoryMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IMemoryMetricUIDAO
.
class
);
this
.
instanceCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
InstanceCacheService
.
class
);
this
.
applicationCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ApplicationCacheService
.
class
);
this
.
secondBetweenService
=
new
SecondBetweenService
(
moduleManager
);
}
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
,
long
end
)
{
List
<
AppServerInfo
>
serverInfos
=
instanceUIDAO
.
searchServer
(
keyword
,
start
,
end
);
public
List
<
AppServerInfo
>
searchServer
(
String
keyword
,
long
start
SecondTimeBucket
,
long
endSecondTimeBucket
)
{
List
<
AppServerInfo
>
serverInfos
=
instanceUIDAO
.
searchServer
(
keyword
,
start
SecondTimeBucket
,
endSecondTimeBucket
);
serverInfos
.
forEach
(
serverInfo
->
{
if
(
serverInfo
.
getId
()
==
Const
.
NONE_INSTANCE_ID
)
{
serverInfos
.
remove
(
serverInfo
);
...
...
@@ -84,25 +86,26 @@ public class ServerService {
return
serverInfos
;
}
public
List
<
AppServerInfo
>
getAllServer
(
int
applicationId
,
long
start
,
long
end
)
{
List
<
AppServerInfo
>
serverInfos
=
instanceUIDAO
.
getAllServer
(
applicationId
,
start
,
end
);
public
List
<
AppServerInfo
>
getAllServer
(
int
applicationId
,
long
start
SecondTimeBucket
,
long
endSecondTimeBucket
)
{
List
<
AppServerInfo
>
serverInfos
=
instanceUIDAO
.
getAllServer
(
applicationId
,
start
SecondTimeBucket
,
endSecondTimeBucket
);
buildAppServerInfo
(
serverInfos
);
return
serverInfos
;
}
public
ResponseTimeTrend
getServerResponseTimeTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
public
ResponseTimeTrend
getServerResponseTimeTrend
(
int
instanceId
,
Step
step
,
long
start
TimeBucket
,
long
end
TimeBucket
)
throws
ParseException
{
ResponseTimeTrend
responseTimeTrend
=
new
ResponseTimeTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
TimeBucket
,
endTimeBucket
);
List
<
Integer
>
trends
=
instanceMetricUIDAO
.
getResponseTimeTrend
(
instanceId
,
step
,
durationPoints
);
responseTimeTrend
.
setTrendList
(
trends
);
return
responseTimeTrend
;
}
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
start
,
long
end
,
Integer
topN
)
throws
ParseException
{
//TODO
List
<
AppServerInfo
>
serverThroughput
=
instanceMetricUIDAO
.
getServerThroughput
(
applicationId
,
step
,
start
,
end
,
1000
,
topN
,
MetricSource
.
Callee
);
public
List
<
AppServerInfo
>
getServerThroughput
(
int
applicationId
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
,
Integer
topN
)
throws
ParseException
{
int
secondBetween
=
secondBetweenService
.
calculate
(
applicationId
,
startSecondTimeBucket
,
endSecondTimeBucket
);
List
<
AppServerInfo
>
serverThroughput
=
instanceMetricUIDAO
.
getServerThroughput
(
applicationId
,
step
,
startTimeBucket
,
endTimeBucket
,
secondBetween
,
topN
,
MetricSource
.
Callee
);
serverThroughput
.
forEach
(
appServerInfo
->
{
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
applicationId
).
getApplicationCode
();
appServerInfo
.
setApplicationCode
(
applicationCode
);
...
...
@@ -114,25 +117,28 @@ public class ServerService {
return
serverThroughput
;
}
public
ThroughputTrend
getServerTPSTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
public
ThroughputTrend
getServerTPSTrend
(
int
instanceId
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
)
throws
ParseException
{
ThroughputTrend
throughputTrend
=
new
ThroughputTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
TimeBucket
,
endTimeBucket
);
List
<
Integer
>
trends
=
instanceMetricUIDAO
.
getServerTPSTrend
(
instanceId
,
step
,
durationPoints
);
throughputTrend
.
setTrendList
(
trends
);
return
throughputTrend
;
}
public
CPUTrend
getCPUTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
public
CPUTrend
getCPUTrend
(
int
instanceId
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
)
throws
ParseException
{
CPUTrend
cpuTrend
=
new
CPUTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
TimeBucket
,
endTimeBucket
);
List
<
Integer
>
trends
=
cpuMetricUIDAO
.
getCPUTrend
(
instanceId
,
step
,
durationPoints
);
cpuTrend
.
setCost
(
trends
);
return
cpuTrend
;
}
public
GCTrend
getGCTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
public
GCTrend
getGCTrend
(
int
instanceId
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
)
throws
ParseException
{
GCTrend
gcTrend
=
new
GCTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
TimeBucket
,
endTimeBucket
);
List
<
Integer
>
youngGCTrend
=
gcMetricUIDAO
.
getYoungGCTrend
(
instanceId
,
step
,
durationPoints
);
gcTrend
.
setYoungGC
(
youngGCTrend
);
List
<
Integer
>
oldGCTrend
=
gcMetricUIDAO
.
getOldGCTrend
(
instanceId
,
step
,
durationPoints
);
...
...
@@ -140,9 +146,9 @@ public class ServerService {
return
gcTrend
;
}
public
MemoryTrend
getMemoryTrend
(
int
instanceId
,
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
public
MemoryTrend
getMemoryTrend
(
int
instanceId
,
Step
step
,
long
start
TimeBucket
,
long
endTimeBucket
)
throws
ParseException
{
MemoryTrend
memoryTrend
=
new
MemoryTrend
();
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
,
end
);
List
<
DurationPoint
>
durationPoints
=
DurationUtils
.
INSTANCE
.
getDurationPoints
(
step
,
start
TimeBucket
,
endTimeBucket
);
IMemoryMetricUIDAO
.
Trend
heapMemoryTrend
=
memoryMetricUIDAO
.
getHeapMemoryTrend
(
instanceId
,
step
,
durationPoints
);
memoryTrend
.
setHeap
(
heapMemoryTrend
.
getMetrics
());
memoryTrend
.
setMaxHeap
(
heapMemoryTrend
.
getMaxMetrics
());
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java
浏览文件 @
28d29117
...
...
@@ -139,11 +139,11 @@ public enum DurationUtils {
return
dateTime
;
}
public
List
<
DurationPoint
>
getDurationPoints
(
Step
step
,
long
start
,
long
end
)
throws
ParseException
{
DateTime
dateTime
=
parseToDateTime
(
step
,
start
);
public
List
<
DurationPoint
>
getDurationPoints
(
Step
step
,
long
start
TimeBucket
,
long
endTimeBucket
)
throws
ParseException
{
DateTime
dateTime
=
parseToDateTime
(
step
,
start
TimeBucket
);
List
<
DurationPoint
>
durations
=
new
LinkedList
<>();
durations
.
add
(
new
DurationPoint
(
start
,
secondsBetween
(
step
,
dateTime
)));
durations
.
add
(
new
DurationPoint
(
start
TimeBucket
,
secondsBetween
(
step
,
dateTime
)));
int
i
=
0
;
do
{
...
...
@@ -176,10 +176,10 @@ public enum DurationUtils {
}
i
++;
if
(
i
>
500
)
{
throw
new
UnexpectedException
(
"Duration data error, step: "
+
step
.
name
()
+
", start: "
+
start
+
", end: "
+
end
);
throw
new
UnexpectedException
(
"Duration data error, step: "
+
step
.
name
()
+
", start: "
+
start
TimeBucket
+
", end: "
+
endTimeBucket
);
}
}
while
(
end
!=
durations
.
get
(
durations
.
size
()
-
1
).
getPoint
());
while
(
end
TimeBucket
!=
durations
.
get
(
durations
.
size
()
-
1
).
getPoint
());
return
durations
;
}
...
...
apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls
浏览文件 @
28d29117
...
...
@@ -8,7 +8,7 @@ type AppServerInfo {
name: String!
applicationId: Int!
applicationCode: String
tps
: Int!
callsPerSec
: Int!
host: String
pid: Int
ipv4: [String!]!
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/DiscoveryRestServiceClient.java
浏览文件 @
28d29117
...
...
@@ -26,6 +26,7 @@ import java.io.IOException;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Random
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.impl.client.CloseableHttpClient
;
...
...
@@ -46,6 +47,9 @@ import static org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig.C
*/
public
class
DiscoveryRestServiceClient
implements
Runnable
{
private
static
final
ILog
logger
=
LogManager
.
getLogger
(
DiscoveryRestServiceClient
.
class
);
private
static
final
int
HTTP_CONNECT_TIMEOUT
=
2000
;
private
static
final
int
HTTP_CONNECTION_REQUEST_TIMEOUT
=
1000
;
private
static
final
int
HTTP_SOCKET_TIMEOUT
=
2000
;
private
String
[]
serverList
;
private
volatile
int
selectedServer
=
-
1
;
...
...
@@ -133,7 +137,11 @@ public class DiscoveryRestServiceClient implements Runnable {
return
null
;
}
HttpGet
httpGet
=
new
HttpGet
(
"http://"
+
serverList
[
selectedServer
]
+
Config
.
Collector
.
DISCOVERY_SERVICE_NAME
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setConnectTimeout
(
HTTP_CONNECT_TIMEOUT
)
.
setConnectionRequestTimeout
(
HTTP_CONNECTION_REQUEST_TIMEOUT
)
.
setSocketTimeout
(
HTTP_SOCKET_TIMEOUT
).
build
();
httpGet
.
setConfig
(
requestConfig
);
return
httpGet
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录