Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
9b6f8723
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 大约 1 年
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
9b6f8723
编写于
3月 04, 2018
作者:
X
Xin,Zhang
提交者:
GitHub
3月 04, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #870 from peng-yongsheng/fixed/855
Fixed/855
上级
10ccd4f1
610edfe4
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
180 addition
and
20 deletion
+180
-20
apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
...segment/parser/provider/service/SegmentBase64Printer.java
+78
-0
apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/resources/log4j2.xml
...ser/segment-parser-provider/src/test/resources/log4j2.xml
+37
-0
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
.../apache/skywalking/apm/collector/ui/query/AlarmQuery.java
+3
-3
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
.../apache/skywalking/apm/collector/ui/query/TraceQuery.java
+3
-3
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
...che/skywalking/apm/collector/ui/service/AlarmService.java
+28
-7
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
+1
-1
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ClusterTopologyService.java
...king/apm/collector/ui/service/ClusterTopologyService.java
+1
-1
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
+5
-1
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/TopologyBuilder.java
.../skywalking/apm/collector/ui/service/TopologyBuilder.java
+24
-4
未找到文件。
apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
0 → 100644
浏览文件 @
9b6f8723
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.collector.analysis.segment.parser.provider.service
;
import
com.google.protobuf.InvalidProtocolBufferException
;
import
java.util.Base64
;
import
java.util.List
;
import
org.apache.skywalking.apm.network.proto.SpanObject
;
import
org.apache.skywalking.apm.network.proto.TraceSegmentObject
;
import
org.apache.skywalking.apm.network.proto.UniqueId
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
SegmentBase64Printer
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SegmentBase64Printer
.
class
);
public
static
void
main
(
String
[]
args
)
throws
InvalidProtocolBufferException
{
String
segmentBase64
=
"CgwKCgIBsv/x1L2vgBsSggEQ////////////ARirnsP1niwg9Z7D9Z4sOhhIMi9KREJJL0Nvbm5lY3Rpb24vY2xvc2VKDGxvY2FsaG9zdDotMVABWAFgBHoOCgdkYi50eXBlEgNzcWx6GQoLZGIuaW5zdGFuY2USCmRhdGFTb3VyY2V6DgoMZGIuc3RhdGVtZW50GP///////////wEgAg=="
;
byte
[]
binarySegment
=
Base64
.
getDecoder
().
decode
(
segmentBase64
);
TraceSegmentObject
segmentObject
=
TraceSegmentObject
.
parseFrom
(
binarySegment
);
UniqueId
segmentId
=
segmentObject
.
getTraceSegmentId
();
StringBuilder
segmentIdBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
segmentId
.
getIdPartsList
().
size
();
i
++)
{
if
(
i
==
0
)
{
segmentIdBuilder
.
append
(
segmentId
.
getIdPartsList
().
get
(
i
));
}
else
{
segmentIdBuilder
.
append
(
"."
).
append
(
segmentId
.
getIdPartsList
().
get
(
i
));
}
}
LOGGER
.
info
(
"SegmentId: {}"
,
segmentIdBuilder
.
toString
());
LOGGER
.
info
(
"ApplicationId: {}"
,
segmentObject
.
getApplicationId
());
LOGGER
.
info
(
"ApplicationInstanceId: {}"
,
segmentObject
.
getApplicationInstanceId
());
List
<
SpanObject
>
spansList
=
segmentObject
.
getSpansList
();
LOGGER
.
info
(
"Spans:"
);
spansList
.
forEach
(
span
->
{
LOGGER
.
info
(
" Span:"
);
LOGGER
.
info
(
" SpanId: {}"
,
span
.
getSpanId
());
LOGGER
.
info
(
" ParentSpanId: {}"
,
span
.
getParentSpanId
());
LOGGER
.
info
(
" SpanLayer: {}"
,
span
.
getSpanLayer
());
LOGGER
.
info
(
" SpanType: {}"
,
span
.
getSpanType
());
LOGGER
.
info
(
" StartTime: {}"
,
span
.
getStartTime
());
LOGGER
.
info
(
" EndTime: {}"
,
span
.
getEndTime
());
LOGGER
.
info
(
" ComponentId: {}"
,
span
.
getComponentId
());
LOGGER
.
info
(
" Component: {}"
,
span
.
getComponent
());
LOGGER
.
info
(
" OperationNameId: {}"
,
span
.
getOperationNameId
());
LOGGER
.
info
(
" OperationName: {}"
,
span
.
getOperationName
());
LOGGER
.
info
(
" PeerId: {}"
,
span
.
getPeerId
());
LOGGER
.
info
(
" Peer: {}"
,
span
.
getPeer
());
LOGGER
.
info
(
" IsError: {}"
,
span
.
getIsError
());
LOGGER
.
info
(
" reference:"
);
span
.
getRefsList
().
forEach
(
reference
->
{
LOGGER
.
info
(
" EntryApplicationInstanceId: {}"
,
reference
.
getEntryApplicationInstanceId
());
});
});
}
}
apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/resources/log4j2.xml
0 → 100644
浏览文件 @
9b6f8723
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<Configuration
status=
"info"
>
<Appenders>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<PatternLayout
charset=
"UTF-8"
pattern=
"%d - %c -%-4r [%t] %-5p %x - %m%n"
/>
</Console>
</Appenders>
<Loggers>
<logger
name=
"org.eclipse.jetty"
level=
"INFO"
/>
<logger
name=
"org.apache.zookeeper"
level=
"INFO"
/>
<logger
name=
"org.elasticsearch.common.network.IfConfig"
level=
"INFO"
/>
<logger
name=
"org.apache.skywalking.apm.collector.agent.grpc.provider.handler.JVMMetricsServiceHandler"
level=
"INFO"
/>
<logger
name=
"org.apache.skywalking.apm.collector.analysis.worker.timer.PersistenceTimer"
level=
"INFO"
/>
<logger
name=
"io.grpc.netty"
level=
"INFO"
/>
<Root
level=
"info"
>
<AppenderRef
ref=
"Console"
/>
</Root>
</Loggers>
</Configuration>
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
浏览文件 @
9b6f8723
...
...
@@ -58,11 +58,11 @@ public class AlarmQuery implements Query {
switch
(
alarmType
)
{
case
APPLICATION:
return
getAlarmService
().
loadApplicationAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
return
getAlarmService
().
loadApplicationAlarmList
(
keyword
,
duration
.
getStep
(),
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
case
SERVER:
return
getAlarmService
().
loadInstanceAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
return
getAlarmService
().
loadInstanceAlarmList
(
keyword
,
duration
.
getStep
(),
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
case
SERVICE:
return
getAlarmService
().
loadServiceAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
return
getAlarmService
().
loadServiceAlarmList
(
keyword
,
duration
.
getStep
(),
startTimeBucket
,
endTimeBucket
,
page
.
getLimit
(),
page
.
getFrom
());
default
:
return
new
Alarm
();
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
浏览文件 @
9b6f8723
...
...
@@ -65,11 +65,11 @@ public class TraceQuery implements Query {
long
endSecondTimeBucket
=
0
;
String
traceId
=
Const
.
EMPTY_STRING
;
if
(
ObjectUtils
.
isNotEmpty
(
condition
.
getQueryDuration
()))
{
if
(
StringUtils
.
isNotEmpty
(
condition
.
getTraceId
()))
{
traceId
=
condition
.
getTraceId
();
}
else
if
(
ObjectUtils
.
isNotEmpty
(
condition
.
getQueryDuration
()))
{
startSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
condition
.
getQueryDuration
().
getStep
(),
condition
.
getQueryDuration
().
getStart
());
endSecondTimeBucket
=
DurationUtils
.
INSTANCE
.
durationToSecondTimeBucket
(
condition
.
getQueryDuration
().
getStep
(),
condition
.
getQueryDuration
().
getEnd
());
}
else
if
(
StringUtils
.
isNotEmpty
(
condition
.
getTraceId
()))
{
traceId
=
condition
.
getTraceId
();
}
else
{
throw
new
UnexpectedException
(
"The condition must contains either queryDuration or traceId."
);
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
浏览文件 @
9b6f8723
...
...
@@ -32,6 +32,7 @@ import org.apache.skywalking.apm.collector.core.util.Const;
import
org.apache.skywalking.apm.collector.storage.StorageModule
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmListUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO
;
...
...
@@ -56,6 +57,7 @@ public class AlarmService {
private
final
Gson
gson
=
new
Gson
();
private
final
IInstanceUIDAO
instanceDAO
;
private
final
IApplicationAlarmUIDAO
applicationAlarmUIDAO
;
private
final
IApplicationMappingUIDAO
applicationMappingUIDAO
;
private
final
IInstanceAlarmUIDAO
instanceAlarmUIDAO
;
private
final
IServiceAlarmUIDAO
serviceAlarmUIDAO
;
private
final
IApplicationAlarmListUIDAO
applicationAlarmListUIDAO
;
...
...
@@ -67,6 +69,7 @@ public class AlarmService {
public
AlarmService
(
ModuleManager
moduleManager
)
{
this
.
instanceDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceUIDAO
.
class
);
this
.
applicationAlarmUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationAlarmUIDAO
.
class
);
this
.
applicationMappingUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationMappingUIDAO
.
class
);
this
.
instanceAlarmUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IInstanceAlarmUIDAO
.
class
);
this
.
serviceAlarmUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IServiceAlarmUIDAO
.
class
);
this
.
applicationAlarmListUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IApplicationAlarmListUIDAO
.
class
);
...
...
@@ -74,12 +77,16 @@ public class AlarmService {
this
.
serviceNameCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ServiceNameCacheService
.
class
);
}
public
Alarm
loadApplicationAlarmList
(
String
keyword
,
long
startTimeBucket
,
long
endTimeBucket
,
public
Alarm
loadApplicationAlarmList
(
String
keyword
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
int
limit
,
int
from
)
throws
ParseException
{
logger
.
debug
(
"keyword: {}, startTimeBucket: {}, endTimeBucket: {}, limit: {}, from: {}"
,
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
Alarm
alarm
=
applicationAlarmUIDAO
.
loadAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
List
<
IApplicationMappingUIDAO
.
ApplicationMapping
>
applicationMappings
=
applicationMappingUIDAO
.
load
(
step
,
startTimeBucket
,
endTimeBucket
);
Map
<
Integer
,
Integer
>
mappings
=
new
HashMap
<>();
applicationMappings
.
forEach
(
applicationMapping
->
mappings
.
put
(
applicationMapping
.
getMappingApplicationId
(),
applicationMapping
.
getApplicationId
()));
alarm
.
getItems
().
forEach
(
item
->
{
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
item
.
getId
(
)).
getApplicationCode
();
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
mappings
.
getOrDefault
(
item
.
getId
(),
item
.
getId
()
)).
getApplicationCode
();
switch
(
item
.
getCauseType
())
{
case
SLOW_RESPONSE:
item
.
setTitle
(
"Application "
+
applicationCode
+
RESPONSE_TIME_ALARM
);
...
...
@@ -92,13 +99,18 @@ public class AlarmService {
return
alarm
;
}
public
Alarm
loadInstanceAlarmList
(
String
keyword
,
long
startTimeBucket
,
long
endTimeBucket
,
public
Alarm
loadInstanceAlarmList
(
String
keyword
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
int
limit
,
int
from
)
throws
ParseException
{
logger
.
debug
(
"keyword: {}, startTimeBucket: {}, endTimeBucket: {}, limit: {}, from: {}"
,
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
Alarm
alarm
=
instanceAlarmUIDAO
.
loadAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
List
<
IApplicationMappingUIDAO
.
ApplicationMapping
>
applicationMappings
=
applicationMappingUIDAO
.
load
(
step
,
startTimeBucket
,
endTimeBucket
);
Map
<
Integer
,
Integer
>
mappings
=
new
HashMap
<>();
applicationMappings
.
forEach
(
applicationMapping
->
mappings
.
put
(
applicationMapping
.
getMappingApplicationId
(),
applicationMapping
.
getApplicationId
()));
alarm
.
getItems
().
forEach
(
item
->
{
Instance
instance
=
instanceDAO
.
getInstance
(
item
.
getId
());
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
instance
.
getApplicationId
(
)).
getApplicationCode
();
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
mappings
.
getOrDefault
(
instance
.
getApplicationId
(),
instance
.
getApplicationId
()
)).
getApplicationCode
();
String
serverName
=
buildServerName
(
instance
.
getOsInfo
());
switch
(
item
.
getCauseType
())
{
case
SLOW_RESPONSE:
...
...
@@ -113,13 +125,18 @@ public class AlarmService {
return
alarm
;
}
public
Alarm
loadServiceAlarmList
(
String
keyword
,
long
startTimeBucket
,
long
endTimeBucket
,
public
Alarm
loadServiceAlarmList
(
String
keyword
,
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
int
limit
,
int
from
)
throws
ParseException
{
logger
.
debug
(
"keyword: {}, startTimeBucket: {}, endTimeBucket: {}, limit: {}, from: {}"
,
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
Alarm
alarm
=
serviceAlarmUIDAO
.
loadAlarmList
(
keyword
,
startTimeBucket
,
endTimeBucket
,
limit
,
from
);
List
<
IApplicationMappingUIDAO
.
ApplicationMapping
>
applicationMappings
=
applicationMappingUIDAO
.
load
(
step
,
startTimeBucket
,
endTimeBucket
);
Map
<
Integer
,
Integer
>
mappings
=
new
HashMap
<>();
applicationMappings
.
forEach
(
applicationMapping
->
mappings
.
put
(
applicationMapping
.
getMappingApplicationId
(),
applicationMapping
.
getApplicationId
()));
alarm
.
getItems
().
forEach
(
item
->
{
ServiceName
serviceName
=
serviceNameCacheService
.
get
(
item
.
getId
());
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
serviceName
.
getApplicationId
(
)).
getApplicationCode
();
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
mappings
.
getOrDefault
(
serviceName
.
getApplicationId
(),
serviceName
.
getApplicationId
()
)).
getApplicationCode
();
switch
(
item
.
getCauseType
())
{
case
SLOW_RESPONSE:
item
.
setTitle
(
"Service "
+
serviceName
.
getServiceName
()
+
" of Application "
+
applicationCode
+
RESPONSE_TIME_ALARM
);
...
...
@@ -146,7 +163,11 @@ public class AlarmService {
AlarmTrend
alarmTrend
=
new
AlarmTrend
();
durationPoints
.
forEach
(
durationPoint
->
{
alarmTrend
.
getNumOfAlarmRate
().
add
((
trendsMap
.
getOrDefault
(
durationPoint
.
getPoint
(),
0
)
*
10000
)
/
(
applications
.
size
()));
if
(
applications
.
size
()
==
0
)
{
alarmTrend
.
getNumOfAlarmRate
().
add
(
0
);
}
else
{
alarmTrend
.
getNumOfAlarmRate
().
add
((
trendsMap
.
getOrDefault
(
durationPoint
.
getPoint
(),
0
)
*
10000
)
/
(
applications
.
size
()));
}
});
return
alarmTrend
;
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationTopologyService.java
浏览文件 @
9b6f8723
...
...
@@ -82,6 +82,6 @@ public class ApplicationTopologyService {
TopologyBuilder
builder
=
new
TopologyBuilder
(
moduleManager
);
return
builder
.
build
(
applicationComponents
,
applicationMappings
,
applicationMetrics
,
callerReferenceMetric
,
calleeReferenceMetric
,
startTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
return
builder
.
build
(
applicationComponents
,
applicationMappings
,
applicationMetrics
,
callerReferenceMetric
,
calleeReferenceMetric
,
st
ep
,
st
artTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ClusterTopologyService.java
浏览文件 @
9b6f8723
...
...
@@ -72,6 +72,6 @@ public class ClusterTopologyService {
TopologyBuilder
builder
=
new
TopologyBuilder
(
moduleManager
);
return
builder
.
build
(
applicationComponents
,
applicationMappings
,
applicationMetrics
,
callerReferenceMetric
,
calleeReferenceMetric
,
startTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
return
builder
.
build
(
applicationComponents
,
applicationMappings
,
applicationMetrics
,
callerReferenceMetric
,
calleeReferenceMetric
,
st
ep
,
st
artTimeBucket
,
endTimeBucket
,
startSecondTimeBucket
,
endSecondTimeBucket
);
}
}
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
浏览文件 @
9b6f8723
...
...
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import
java.util.List
;
import
org.apache.skywalking.apm.collector.cache.CacheModule
;
import
org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService
;
import
org.apache.skywalking.apm.collector.cache.service.InstanceCacheService
;
import
org.apache.skywalking.apm.collector.core.module.ModuleManager
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.core.util.StringUtils
;
...
...
@@ -59,6 +60,7 @@ public class ServerService {
private
final
IGCMetricUIDAO
gcMetricUIDAO
;
private
final
IMemoryMetricUIDAO
memoryMetricUIDAO
;
private
final
ApplicationCacheService
applicationCacheService
;
private
final
InstanceCacheService
instanceCacheService
;
private
final
SecondBetweenService
secondBetweenService
;
public
ServerService
(
ModuleManager
moduleManager
)
{
...
...
@@ -68,6 +70,7 @@ public class ServerService {
this
.
gcMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IGCMetricUIDAO
.
class
);
this
.
memoryMetricUIDAO
=
moduleManager
.
find
(
StorageModule
.
NAME
).
getService
(
IMemoryMetricUIDAO
.
class
);
this
.
applicationCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ApplicationCacheService
.
class
);
this
.
instanceCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
InstanceCacheService
.
class
);
this
.
secondBetweenService
=
new
SecondBetweenService
(
moduleManager
);
}
...
...
@@ -105,7 +108,8 @@ public class ServerService {
List
<
AppServerInfo
>
serverThroughput
=
instanceMetricUIDAO
.
getServerThroughput
(
applicationId
,
step
,
startTimeBucket
,
endTimeBucket
,
secondBetween
,
topN
,
MetricSource
.
Callee
);
serverThroughput
.
forEach
(
appServerInfo
->
{
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
applicationId
).
getApplicationCode
();
appServerInfo
.
setApplicationId
(
instanceCacheService
.
getApplicationId
(
appServerInfo
.
getId
()));
String
applicationCode
=
applicationCacheService
.
getApplicationById
(
appServerInfo
.
getApplicationId
()).
getApplicationCode
();
appServerInfo
.
setApplicationCode
(
applicationCode
);
Instance
instance
=
instanceUIDAO
.
getInstance
(
appServerInfo
.
getId
());
appServerInfo
.
setOsInfo
(
instance
.
getOsInfo
());
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/TopologyBuilder.java
浏览文件 @
9b6f8723
...
...
@@ -20,9 +20,11 @@ package org.apache.skywalking.apm.collector.ui.service;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.skywalking.apm.collector.cache.CacheModule
;
import
org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService
;
import
org.apache.skywalking.apm.collector.core.module.ModuleManager
;
...
...
@@ -38,6 +40,7 @@ import org.apache.skywalking.apm.collector.storage.ui.application.ApplicationNod
import
org.apache.skywalking.apm.collector.storage.ui.application.ConjecturalNode
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Call
;
import
org.apache.skywalking.apm.collector.storage.ui.common.Node
;
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.collector.storage.ui.common.VisualUserNode
;
import
org.apache.skywalking.apm.collector.ui.utils.ApdexCalculator
;
...
...
@@ -70,7 +73,7 @@ class TopologyBuilder {
List
<
IApplicationMetricUIDAO
.
ApplicationMetric
>
applicationMetrics
,
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
callerReferenceMetric
,
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
calleeReferenceMetric
,
long
startTimeBucket
,
long
endTimeBucket
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
{
Step
step
,
long
startTimeBucket
,
long
endTimeBucket
,
long
startSecondTimeBucket
,
long
endSecondTimeBucket
)
{
Map
<
Integer
,
String
>
components
=
changeNodeComp2Map
(
applicationComponents
);
Map
<
Integer
,
Integer
>
mappings
=
changeMapping2Map
(
applicationMappings
);
...
...
@@ -95,7 +98,7 @@ class TopologyBuilder {
applicationNode
.
setApdex
(
ApdexCalculator
.
INSTANCE
.
calculate
(
applicationMetric
.
getSatisfiedCount
(),
applicationMetric
.
getToleratingCount
(),
applicationMetric
.
getFrustratedCount
()));
applicationNode
.
setAlarm
(
false
);
try
{
Alarm
alarm
=
alarmService
.
loadApplicationAlarmList
(
Const
.
EMPTY_STRING
,
startTimeBucket
,
endTimeBucket
,
1
,
0
);
Alarm
alarm
=
alarmService
.
loadApplicationAlarmList
(
Const
.
EMPTY_STRING
,
st
ep
,
st
artTimeBucket
,
endTimeBucket
,
1
,
0
);
if
(
alarm
.
getItems
().
size
()
>
0
)
{
applicationNode
.
setAlarm
(
true
);
}
...
...
@@ -105,14 +108,14 @@ class TopologyBuilder {
applicationNode
.
setNumOfServer
(
serverService
.
getAllServer
(
applicationId
,
startSecondTimeBucket
,
endSecondTimeBucket
).
size
());
try
{
Alarm
alarm
=
alarmService
.
loadInstanceAlarmList
(
Const
.
EMPTY_STRING
,
startTimeBucket
,
endTimeBucket
,
1000
,
0
);
Alarm
alarm
=
alarmService
.
loadInstanceAlarmList
(
Const
.
EMPTY_STRING
,
st
ep
,
st
artTimeBucket
,
endTimeBucket
,
1000
,
0
);
applicationNode
.
setNumOfServerAlarm
(
alarm
.
getItems
().
size
());
}
catch
(
ParseException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
try
{
Alarm
alarm
=
alarmService
.
loadServiceAlarmList
(
Const
.
EMPTY_STRING
,
startTimeBucket
,
endTimeBucket
,
1000
,
0
);
Alarm
alarm
=
alarmService
.
loadServiceAlarmList
(
Const
.
EMPTY_STRING
,
st
ep
,
st
artTimeBucket
,
endTimeBucket
,
1000
,
0
);
applicationNode
.
setNumOfServiceAlarm
(
alarm
.
getItems
().
size
());
}
catch
(
ParseException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -133,6 +136,17 @@ class TopologyBuilder {
nodes
.
add
(
conjecturalNode
);
}
Set
<
Integer
>
nodeIds
=
buildNodeIds
(
nodes
);
if
(!
nodeIds
.
contains
(
source
.
getApplicationId
()))
{
ApplicationNode
applicationNode
=
new
ApplicationNode
();
applicationNode
.
setId
(
source
.
getApplicationId
());
applicationNode
.
setName
(
source
.
getApplicationCode
());
applicationNode
.
setType
(
components
.
getOrDefault
(
source
.
getApplicationId
(),
Const
.
UNKNOWN
));
applicationNode
.
setApdex
(
100
);
applicationNode
.
setSla
(
100
);
nodes
.
add
(
applicationNode
);
}
Call
call
=
new
Call
();
call
.
setSource
(
source
.
getApplicationId
());
call
.
setSourceName
(
source
.
getApplicationCode
());
...
...
@@ -198,6 +212,12 @@ class TopologyBuilder {
return
topology
;
}
private
Set
<
Integer
>
buildNodeIds
(
List
<
Node
>
nodes
)
{
Set
<
Integer
>
nodeIds
=
new
HashSet
<>();
nodes
.
forEach
(
node
->
nodeIds
.
add
(
node
.
getId
()));
return
nodeIds
;
}
private
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
calleeReferenceMetricFilter
(
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
calleeReferenceMetric
)
{
List
<
IApplicationReferenceMetricUIDAO
.
ApplicationReferenceMetric
>
filteredMetrics
=
new
LinkedList
<>();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录