Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
3eeacb1a
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,发现更多精彩内容 >>
提交
3eeacb1a
编写于
2月 12, 2018
作者:
L
lytscu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update comments
上级
59380c46
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
22 deletion
+18
-22
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/ProducerOperationHandlerInterceptor.java
...ugin/servicecomb/ProducerOperationHandlerInterceptor.java
+3
-5
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/TransportClientHandlerInterceptor.java
...plugin/servicecomb/TransportClientHandlerInterceptor.java
+12
-14
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/ProducerOperationHandlerInstrumentation.java
...ecomb/define/ProducerOperationHandlerInstrumentation.java
+2
-2
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/TransportClientHandlerInstrumentation.java
...icecomb/define/TransportClientHandlerInstrumentation.java
+1
-1
未找到文件。
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/ProducerOperationHandlerInterceptor.java
浏览文件 @
3eeacb1a
...
@@ -32,7 +32,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
...
@@ -32,7 +32,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
/**
/**
* {org.apache.skywalking.apm.plugin.servicecomb.} define how to enhance class {@link Invocation#getHandlerContext()}.
* {org.apache.skywalking.apm.plugin.servicecomb.ProducerOperationHandlerInterceptor} define how to enhance class {@link
* ProducerOperationHandler#handle(io.servicecomb.core.Invocation, io.servicecomb.swagger.invocation.AsyncResponse)}.
*
*
* @author lytscu
* @author lytscu
*/
*/
...
@@ -48,10 +49,7 @@ public class ProducerOperationHandlerInterceptor implements InstanceMethodsAroun
...
@@ -48,10 +49,7 @@ public class ProducerOperationHandlerInterceptor implements InstanceMethodsAroun
next
=
next
.
next
();
next
=
next
.
next
();
next
.
setHeadValue
(
invocation
.
getContext
().
get
(
next
.
getHeadKey
()));
next
.
setHeadValue
(
invocation
.
getContext
().
get
(
next
.
getHeadKey
()));
}
}
String
operationName
=
"servicecomb/chassis"
+
method
.
getName
();
String
operationName
=
invocation
.
getMicroserviceQualifiedName
();
if
(
null
!=
invocation
.
getOperationMeta
())
{
operationName
=
invocation
.
getMicroserviceQualifiedName
();
}
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
operationName
,
contextCarrier
);
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
operationName
,
contextCarrier
);
String
url
=
invocation
.
getOperationMeta
().
getOperationPath
();
String
url
=
invocation
.
getOperationMeta
().
getOperationPath
();
Tags
.
URL
.
set
(
span
,
url
);
Tags
.
URL
.
set
(
span
,
url
);
...
...
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/TransportClientHandlerInterceptor.java
浏览文件 @
3eeacb1a
...
@@ -21,7 +21,6 @@ package org.apache.skywalking.apm.plugin.servicecomb;
...
@@ -21,7 +21,6 @@ package org.apache.skywalking.apm.plugin.servicecomb;
import
io.servicecomb.core.Invocation
;
import
io.servicecomb.core.Invocation
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
org.apache.skywalking.apm.agent.core.context.CarrierItem
;
import
org.apache.skywalking.apm.agent.core.context.CarrierItem
;
import
org.apache.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.apache.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
...
@@ -34,7 +33,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
...
@@ -34,7 +33,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
/**
/**
* {@link TransportClientHandlerInterceptor} define how to enhance class {@link Invocation#next(io.servicecomb.swagger.invocation.AsyncResponse)}.
* {@link TransportClientHandlerInterceptor} define how to enhance class {@link TransportClientHandler#handle(io.servicecomb.core.Invocation,
* io.servicecomb.swagger.invocation.AsyncResponse)}.
*
*
* @author lytscu
* @author lytscu
*/
*/
...
@@ -44,10 +44,11 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
...
@@ -44,10 +44,11 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
String
peer
=
AsserRegister
(
invocation
);
if
(!
checkRegisterStatus
(
invocation
))
{
if
(
null
==
peer
)
{
return
;
return
;
}
}
URI
uri
=
new
URI
(
invocation
.
getEndpoint
().
toString
());
String
peer
=
uri
.
getHost
()
+
":"
+
uri
.
getPort
();
String
operationName
=
invocation
.
getMicroserviceQualifiedName
();
String
operationName
=
invocation
.
getMicroserviceQualifiedName
();
final
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
final
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
operationName
,
contextCarrier
,
peer
);
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
operationName
,
contextCarrier
,
peer
);
...
@@ -65,8 +66,7 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
...
@@ -65,8 +66,7 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
String
peer
=
AsserRegister
(
invocation
);
if
(!
checkRegisterStatus
(
invocation
))
{
if
(
null
==
peer
)
{
return
ret
;
return
ret
;
}
}
AbstractSpan
span
=
ContextManager
.
activeSpan
();
AbstractSpan
span
=
ContextManager
.
activeSpan
();
...
@@ -82,7 +82,7 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
...
@@ -82,7 +82,7 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
Invocation
invocation
=
(
Invocation
)
allArguments
[
0
];
if
(
null
==
invocation
.
getOperationMeta
()
||
null
==
invocation
.
getEndpoint
(
))
{
if
(
!
checkRegisterStatus
(
invocation
))
{
return
;
return
;
}
}
AbstractSpan
span
=
ContextManager
.
activeSpan
();
AbstractSpan
span
=
ContextManager
.
activeSpan
();
...
@@ -91,16 +91,14 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
...
@@ -91,16 +91,14 @@ public class TransportClientHandlerInterceptor implements InstanceMethodsAroundI
}
}
/**
/**
* Serviecomb ch
i
ssis Consumers and providers need to register at the service center. If the consumer is not
* Serviecomb ch
a
ssis Consumers and providers need to register at the service center. If the consumer is not
* registered then return
* registered then return
false.
*/
*/
private
String
AsserRegister
(
Invocation
invocation
)
throws
URISyntaxException
{
private
Boolean
checkRegisterStatus
(
Invocation
invocation
)
{
if
(
null
==
invocation
.
getOperationMeta
()
||
null
==
invocation
.
getEndpoint
())
{
if
(
null
==
invocation
.
getOperationMeta
()
||
null
==
invocation
.
getEndpoint
())
{
return
null
;
return
false
;
}
}
URI
uri
=
new
URI
(
invocation
.
getEndpoint
().
toString
());
return
true
;
String
peer
=
uri
.
getHost
()
+
":"
+
uri
.
getPort
();
return
peer
;
}
}
}
}
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/ProducerOperationHandlerInstrumentation.java
浏览文件 @
3eeacb1a
...
@@ -29,8 +29,8 @@ import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
...
@@ -29,8 +29,8 @@ import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
/**
* {@link ProducerOperationHandlerInstrumentation} presents that skywalking intercept {@link
* {@link ProducerOperationHandlerInstrumentation}
re
presents that skywalking intercept {@link
* ProducerOperationHandler#handle
(io.servicecomb.core.Invocation, io.servicecomb.swagger.invocation.AsyncResponse)#
}by
* ProducerOperationHandler#handle
(io.servicecomb.core.Invocation, io.servicecomb.swagger.invocation.AsyncResponse)
}by
* using {@link ProducerOperationHandlerInterceptor}
* using {@link ProducerOperationHandlerInterceptor}
*
*
* @author lytscu
* @author lytscu
...
...
apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/define/TransportClientHandlerInstrumentation.java
浏览文件 @
3eeacb1a
...
@@ -30,7 +30,7 @@ import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
...
@@ -30,7 +30,7 @@ import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
/**
* {@link TransportClientHandlerInstrumentation} presents that skywalking intercept {@link TransportClientHandler}by
* {@link TransportClientHandlerInstrumentation}
re
presents that skywalking intercept {@link TransportClientHandler}by
* using {@linkTransportClientHandlerInterceptor }
* using {@linkTransportClientHandlerInterceptor }
*
*
* @author lytscu
* @author lytscu
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录