Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
6b20b3e3
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b20b3e3
编写于
1月 03, 2018
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Service reference metric test ok.
上级
a9ae31df
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
32 deletion
+51
-32
apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json
...tty-provider/src/test/resources/json/dubbox-consumer.json
+1
-1
apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json
...tty-provider/src/test/resources/json/dubbox-provider.json
+3
-3
apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/ServiceReferenceMetricSpanListener.java
...er/worker/service/ServiceReferenceMetricSpanListener.java
+29
-22
apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java
...er/provider/register/ApplicationRegisterSerialWorker.java
+2
-2
apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/InstanceRegisterSerialWorker.java
...ister/provider/register/InstanceRegisterSerialWorker.java
+14
-2
apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/Const.java
.../org/apache/skywalking/apm/collector/core/util/Const.java
+2
-2
未找到文件。
apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json
浏览文件 @
6b20b3e3
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
24040000
24040000
],
],
"ai"
:
-1
,
"ai"
:
-1
,
"ii"
:
1
,
"ii"
:
2
,
"rs"
:
[],
"rs"
:
[],
"ss"
:
[
"ss"
:
[
{
{
...
...
apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json
浏览文件 @
6b20b3e3
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
48780000
48780000
],
],
"ai"
:
2
,
"ai"
:
2
,
"ii"
:
2
,
"ii"
:
3
,
"ss"
:
[
"ss"
:
[
{
{
"si"
:
0
,
"si"
:
0
,
...
@@ -37,13 +37,13 @@
...
@@ -37,13 +37,13 @@
185809
,
185809
,
24040000
24040000
],
],
"pii"
:
1
,
"pii"
:
2
,
"psp"
:
0
,
"psp"
:
0
,
"psi"
:
0
,
"psi"
:
0
,
"psn"
:
"/dubbox-case/case/dubbox-rest"
,
"psn"
:
"/dubbox-case/case/dubbox-rest"
,
"ni"
:
0
,
"ni"
:
0
,
"nn"
:
"172.25.0.4:20880"
,
"nn"
:
"172.25.0.4:20880"
,
"eii"
:
1
,
"eii"
:
2
,
"esi"
:
0
,
"esi"
:
0
,
"esn"
:
"/dubbox-case/case/dubbox-rest"
,
"esn"
:
"/dubbox-case/case/dubbox-rest"
,
"rn"
:
0
"rn"
:
0
...
...
apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/ServiceReferenceMetricSpanListener.java
浏览文件 @
6b20b3e3
...
@@ -30,6 +30,7 @@ import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listen
...
@@ -30,6 +30,7 @@ import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listen
import
org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.SpanListener
;
import
org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.SpanListener
;
import
org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.SpanListenerFactory
;
import
org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.SpanListenerFactory
;
import
org.apache.skywalking.apm.collector.cache.CacheModule
;
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.cache.service.InstanceCacheService
;
import
org.apache.skywalking.apm.collector.core.graph.Graph
;
import
org.apache.skywalking.apm.collector.core.graph.Graph
;
import
org.apache.skywalking.apm.collector.core.graph.GraphManager
;
import
org.apache.skywalking.apm.collector.core.graph.GraphManager
;
...
@@ -49,14 +50,18 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
...
@@ -49,14 +50,18 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceReferenceMetricSpanListener
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceReferenceMetricSpanListener
.
class
);
private
InstanceCacheService
instanceCacheService
;
private
final
InstanceCacheService
instanceCacheService
;
private
List
<
ServiceReferenceMetric
>
entryReferenceMetric
=
new
LinkedList
<>();
private
final
ApplicationCacheService
applicationCacheService
;
private
List
<
ServiceReferenceMetric
>
exitReferenceMetric
=
new
LinkedList
<>();
private
final
List
<
ServiceReferenceMetric
>
entryReferenceMetric
;
private
List
<
ServiceReferenceMetric
>
exitReferenceMetric
;
private
SpanDecorator
entrySpanDecorator
;
private
SpanDecorator
entrySpanDecorator
;
private
long
timeBucket
;
private
long
timeBucket
;
public
ServiceReferenceMetricSpanListener
(
ModuleManager
moduleManager
)
{
public
ServiceReferenceMetricSpanListener
(
ModuleManager
moduleManager
)
{
this
.
entryReferenceMetric
=
new
LinkedList
<>();
this
.
exitReferenceMetric
=
new
LinkedList
<>();
this
.
instanceCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
InstanceCacheService
.
class
);
this
.
instanceCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
InstanceCacheService
.
class
);
this
.
applicationCacheService
=
moduleManager
.
find
(
CacheModule
.
NAME
).
getService
(
ApplicationCacheService
.
class
);
}
}
@Override
@Override
...
@@ -79,20 +84,20 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
...
@@ -79,20 +84,20 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric
.
setBehindInstanceId
(
instanceId
);
serviceReferenceMetric
.
setBehindInstanceId
(
instanceId
);
serviceReferenceMetric
.
setBehindApplicationId
(
applicationId
);
serviceReferenceMetric
.
setBehindApplicationId
(
applicationId
);
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Callee
.
getValue
());
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Callee
.
getValue
());
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
,
true
);
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
);
entryReferenceMetric
.
add
(
serviceReferenceMetric
);
entryReferenceMetric
.
add
(
serviceReferenceMetric
);
}
}
}
else
{
}
else
{
ServiceReferenceMetric
serviceReferenceMetric
=
new
ServiceReferenceMetric
(
Const
.
EMPTY_STRING
);
ServiceReferenceMetric
serviceReferenceMetric
=
new
ServiceReferenceMetric
(
Const
.
EMPTY_STRING
);
serviceReferenceMetric
.
setFrontServiceId
(
Const
.
NONE_SERVICE_ID
);
serviceReferenceMetric
.
setFrontServiceId
(
Const
.
NONE_SERVICE_ID
);
serviceReferenceMetric
.
setFrontInstanceId
(
instanceId
);
serviceReferenceMetric
.
setFrontInstanceId
(
Const
.
NONE_INSTANCE_ID
);
serviceReferenceMetric
.
setFrontApplicationId
(
applicationId
);
serviceReferenceMetric
.
setFrontApplicationId
(
Const
.
NONE_APPLICATION_ID
);
serviceReferenceMetric
.
setBehindServiceId
(
spanDecorator
.
getOperationNameId
());
serviceReferenceMetric
.
setBehindServiceId
(
spanDecorator
.
getOperationNameId
());
serviceReferenceMetric
.
setBehindInstanceId
(
instanceId
);
serviceReferenceMetric
.
setBehindInstanceId
(
instanceId
);
serviceReferenceMetric
.
setBehindApplicationId
(
applicationId
);
serviceReferenceMetric
.
setBehindApplicationId
(
applicationId
);
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Callee
.
getValue
());
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Callee
.
getValue
());
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
,
false
);
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
);
entryReferenceMetric
.
add
(
serviceReferenceMetric
);
entryReferenceMetric
.
add
(
serviceReferenceMetric
);
}
}
this
.
entrySpanDecorator
=
spanDecorator
;
this
.
entrySpanDecorator
=
spanDecorator
;
...
@@ -101,18 +106,22 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
...
@@ -101,18 +106,22 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
@Override
public
void
parseExit
(
SpanDecorator
spanDecorator
,
int
applicationId
,
int
instanceId
,
String
segmentId
)
{
@Override
public
void
parseExit
(
SpanDecorator
spanDecorator
,
int
applicationId
,
int
instanceId
,
String
segmentId
)
{
ServiceReferenceMetric
serviceReferenceMetric
=
new
ServiceReferenceMetric
(
Const
.
EMPTY_STRING
);
ServiceReferenceMetric
serviceReferenceMetric
=
new
ServiceReferenceMetric
(
Const
.
EMPTY_STRING
);
serviceReferenceMetric
.
setFrontApplicationId
(
applicationId
);
int
peerId
=
spanDecorator
.
getPeerId
();
int
behindApplicationId
=
applicationCacheService
.
getApplicationIdByAddressId
(
peerId
);
int
behindInstanceId
=
instanceCacheService
.
getInstanceIdByAddressId
(
behindApplicationId
,
peerId
);
serviceReferenceMetric
.
setFrontServiceId
(
Const
.
NONE_SERVICE_ID
);
serviceReferenceMetric
.
setFrontInstanceId
(
instanceId
);
serviceReferenceMetric
.
setFrontInstanceId
(
instanceId
);
// serviceReferenceMetric.setBehindApplicationId();
serviceReferenceMetric
.
setFrontApplicationId
(
applicationId
);
// serviceReferenceMetric.setBehindInstanceId();
serviceReferenceMetric
.
setBehindServiceId
(
spanDecorator
.
getOperationNameId
());
serviceReferenceMetric
.
setBehindServiceId
(
spanDecorator
.
getOperationNameId
());
serviceReferenceMetric
.
setBehindInstanceId
(
behindInstanceId
);
serviceReferenceMetric
.
setBehindApplicationId
(
behindApplicationId
);
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Caller
.
getValue
());
serviceReferenceMetric
.
setSourceValue
(
MetricSource
.
Caller
.
getValue
());
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
,
true
);
calculateDuration
(
serviceReferenceMetric
,
spanDecorator
);
exitReferenceMetric
.
add
(
serviceReferenceMetric
);
exitReferenceMetric
.
add
(
serviceReferenceMetric
);
}
}
private
void
calculateDuration
(
ServiceReferenceMetric
serviceReferenceMetric
,
SpanDecorator
spanDecorator
,
private
void
calculateDuration
(
ServiceReferenceMetric
serviceReferenceMetric
,
SpanDecorator
spanDecorator
)
{
boolean
hasReference
)
{
long
duration
=
spanDecorator
.
getEndTime
()
-
spanDecorator
.
getStartTime
();
long
duration
=
spanDecorator
.
getEndTime
()
-
spanDecorator
.
getStartTime
();
if
(
spanDecorator
.
getIsError
())
{
if
(
spanDecorator
.
getIsError
())
{
...
@@ -122,15 +131,6 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
...
@@ -122,15 +131,6 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric
.
setTransactionCalls
(
1L
);
serviceReferenceMetric
.
setTransactionCalls
(
1L
);
serviceReferenceMetric
.
setTransactionDurationSum
(
duration
);
serviceReferenceMetric
.
setTransactionDurationSum
(
duration
);
if
(
hasReference
)
{
if
(
spanDecorator
.
getIsError
())
{
serviceReferenceMetric
.
setBusinessTransactionErrorCalls
(
1L
);
serviceReferenceMetric
.
setBusinessTransactionErrorDurationSum
(
duration
);
}
serviceReferenceMetric
.
setBusinessTransactionCalls
(
1L
);
serviceReferenceMetric
.
setBusinessTransactionDurationSum
(
duration
);
}
if
(
SpanLayer
.
MQ
.
equals
(
spanDecorator
.
getSpanLayer
()))
{
if
(
SpanLayer
.
MQ
.
equals
(
spanDecorator
.
getSpanLayer
()))
{
if
(
spanDecorator
.
getIsError
())
{
if
(
spanDecorator
.
getIsError
())
{
serviceReferenceMetric
.
setMqTransactionErrorCalls
(
1L
);
serviceReferenceMetric
.
setMqTransactionErrorCalls
(
1L
);
...
@@ -138,6 +138,13 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
...
@@ -138,6 +138,13 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
}
}
serviceReferenceMetric
.
setMqTransactionCalls
(
1L
);
serviceReferenceMetric
.
setMqTransactionCalls
(
1L
);
serviceReferenceMetric
.
setMqTransactionDurationSum
(
duration
);
serviceReferenceMetric
.
setMqTransactionDurationSum
(
duration
);
}
else
{
if
(
spanDecorator
.
getIsError
())
{
serviceReferenceMetric
.
setBusinessTransactionErrorCalls
(
1L
);
serviceReferenceMetric
.
setBusinessTransactionErrorDurationSum
(
duration
);
}
serviceReferenceMetric
.
setBusinessTransactionCalls
(
1L
);
serviceReferenceMetric
.
setBusinessTransactionDurationSum
(
duration
);
}
}
}
}
...
...
apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java
浏览文件 @
6b20b3e3
...
@@ -60,9 +60,9 @@ public class ApplicationRegisterSerialWorker extends AbstractLocalAsyncWorker<Ap
...
@@ -60,9 +60,9 @@ public class ApplicationRegisterSerialWorker extends AbstractLocalAsyncWorker<Ap
Application
newApplication
;
Application
newApplication
;
int
min
=
applicationRegisterDAO
.
getMinApplicationId
();
int
min
=
applicationRegisterDAO
.
getMinApplicationId
();
if
(
min
==
0
)
{
if
(
min
==
0
)
{
Application
userApplication
=
new
Application
(
String
.
valueOf
(
Const
.
USER
_ID
));
Application
userApplication
=
new
Application
(
String
.
valueOf
(
Const
.
NONE_APPLICATION
_ID
));
userApplication
.
setApplicationCode
(
Const
.
USER_CODE
);
userApplication
.
setApplicationCode
(
Const
.
USER_CODE
);
userApplication
.
setApplicationId
(
Const
.
USER
_ID
);
userApplication
.
setApplicationId
(
Const
.
NONE_APPLICATION
_ID
);
userApplication
.
setAddressId
(
Const
.
NONE
);
userApplication
.
setAddressId
(
Const
.
NONE
);
userApplication
.
setIsAddress
(
false
);
userApplication
.
setIsAddress
(
false
);
applicationRegisterDAO
.
save
(
userApplication
);
applicationRegisterDAO
.
save
(
userApplication
);
...
...
apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/InstanceRegisterSerialWorker.java
浏览文件 @
6b20b3e3
...
@@ -25,6 +25,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerExce
...
@@ -25,6 +25,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerExce
import
org.apache.skywalking.apm.collector.cache.CacheModule
;
import
org.apache.skywalking.apm.collector.cache.CacheModule
;
import
org.apache.skywalking.apm.collector.cache.service.InstanceCacheService
;
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.module.ModuleManager
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.StorageModule
;
import
org.apache.skywalking.apm.collector.storage.StorageModule
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.Instance
;
import
org.apache.skywalking.apm.collector.storage.table.register.Instance
;
...
@@ -60,8 +61,19 @@ public class InstanceRegisterSerialWorker extends AbstractLocalAsyncWorker<Insta
...
@@ -60,8 +61,19 @@ public class InstanceRegisterSerialWorker extends AbstractLocalAsyncWorker<Insta
int
min
=
instanceRegisterDAO
.
getMinInstanceId
();
int
min
=
instanceRegisterDAO
.
getMinInstanceId
();
int
max
=
instanceRegisterDAO
.
getMaxInstanceId
();
int
max
=
instanceRegisterDAO
.
getMaxInstanceId
();
if
(
min
==
0
&&
max
==
0
)
{
if
(
min
==
0
&&
max
==
0
)
{
newInstance
=
new
Instance
(
"1"
);
Instance
userInstance
=
new
Instance
(
String
.
valueOf
(
Const
.
NONE_INSTANCE_ID
));
newInstance
.
setInstanceId
(
1
);
userInstance
.
setInstanceId
(
Const
.
NONE_INSTANCE_ID
);
userInstance
.
setApplicationId
(
Const
.
NONE_APPLICATION_ID
);
userInstance
.
setAgentUUID
(
Const
.
USER_CODE
);
userInstance
.
setHeartBeatTime
(
System
.
currentTimeMillis
());
userInstance
.
setOsInfo
(
Const
.
EMPTY_STRING
);
userInstance
.
setRegisterTime
(
System
.
currentTimeMillis
());
userInstance
.
setAddressId
(
Const
.
NONE
);
userInstance
.
setIsAddress
(
false
);
instanceRegisterDAO
.
save
(
userInstance
);
newInstance
=
new
Instance
(
"2"
);
newInstance
.
setInstanceId
(
2
);
newInstance
.
setApplicationId
(
instance
.
getApplicationId
());
newInstance
.
setApplicationId
(
instance
.
getApplicationId
());
newInstance
.
setAgentUUID
(
instance
.
getAgentUUID
());
newInstance
.
setAgentUUID
(
instance
.
getAgentUUID
());
newInstance
.
setHeartBeatTime
(
instance
.
getHeartBeatTime
());
newInstance
.
setHeartBeatTime
(
instance
.
getHeartBeatTime
());
...
...
apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/Const.java
浏览文件 @
6b20b3e3
...
@@ -24,9 +24,9 @@ package org.apache.skywalking.apm.collector.core.util;
...
@@ -24,9 +24,9 @@ package org.apache.skywalking.apm.collector.core.util;
public
class
Const
{
public
class
Const
{
public
static
final
int
NONE
=
0
;
public
static
final
int
NONE
=
0
;
public
static
final
String
ID_SPLIT
=
"_"
;
public
static
final
String
ID_SPLIT
=
"_"
;
public
static
final
int
USER_ID
=
1
;
public
static
final
int
NONE_APPLICATION_ID
=
1
;
public
static
final
int
NONE_SERVICE_ID
=
1
;
public
static
final
int
NONE_INSTANCE_ID
=
1
;
public
static
final
int
NONE_INSTANCE_ID
=
1
;
public
static
final
int
NONE_SERVICE_ID
=
1
;
public
static
final
String
NONE_SERVICE_NAME
=
"None"
;
public
static
final
String
NONE_SERVICE_NAME
=
"None"
;
public
static
final
String
USER_CODE
=
"User"
;
public
static
final
String
USER_CODE
=
"User"
;
public
static
final
String
SEGMENT_SPAN_SPLIT
=
"S"
;
public
static
final
String
SEGMENT_SPAN_SPLIT
=
"S"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录