Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
8419aa3e
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,发现更多精彩内容 >>
提交
8419aa3e
编写于
2月 28, 2018
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor topology build logic.
上级
ea33be3c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
59 addition
and
168 deletion
+59
-168
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-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-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-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
+6
-3
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-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationComponentUIDAO.java
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationComponentEsUIDAO.java
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationComponentH2UIDAO.java
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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
浏览文件 @
8419aa3e
...
...
@@ -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-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java
浏览文件 @
8419aa3e
...
...
@@ -76,10 +76,13 @@ 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
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
getApplicationTopologyService
().
getApplicationTopology
(
duration
.
getStep
(),
applicationId
,
start
,
end
);
return
getApplicationTopologyService
().
getApplicationTopology
(
duration
.
getStep
(),
applicationId
,
start
TimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
}
public
List
<
ServiceMetric
>
getSlowService
(
int
applicationId
,
Duration
duration
,
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationTopologyService.java
浏览文件 @
8419aa3e
...
...
@@ -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
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录