Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
ce1c7aad
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,发现更多精彩内容 >>
提交
ce1c7aad
编写于
4月 16, 2019
作者:
B
Brandon Fergerson
提交者:
wu-sheng
4月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Vert.x Core 3.x Plugin (#2386)
* vertx plugin impl
上级
11212c40
变更
29
隐藏空白更改
内联
并排
Showing
29 changed file
with
1513 addition
and
4 deletion
+1513
-4
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+4
-1
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java
...skywalking/apm/agent/core/context/trace/AbstractSpan.java
+3
-3
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/pom.xml
apm-sniffer/apm-sdk-plugin/vertx-plugins/pom.xml
+43
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/pom.xml
...pm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/pom.xml
+45
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/ClusteredEventBusSendRemoteInterceptor.java
...plugin/vertx3/ClusteredEventBusSendRemoteInterceptor.java
+84
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/EventBusImplDeliverToHandlerInterceptor.java
...lugin/vertx3/EventBusImplDeliverToHandlerInterceptor.java
+85
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HandlerRegistrationInterceptor.java
...ing/apm/plugin/vertx3/HandlerRegistrationInterceptor.java
+98
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
...pm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
+95
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleExceptionInterceptor.java
...rtx3/HttpClientRequestImplHandleExceptionInterceptor.java
+51
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java
...ertx3/HttpClientRequestImplHandleResponseInterceptor.java
+60
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java
...m/plugin/vertx3/HttpServerResponseImplEndInterceptor.java
+53
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplHandleExceptionInterceptor.java
...tx3/HttpServerResponseImplHandleExceptionInterceptor.java
+51
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
...alking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
+82
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java
...org/apache/skywalking/apm/plugin/vertx3/VertxContext.java
+75
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/ClusteredEventBusSendRemoteInstrumentation.java
...x3/define/ClusteredEventBusSendRemoteInstrumentation.java
+74
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/EventBusImplDeliverToHandlerInstrumentation.java
...3/define/EventBusImplDeliverToHandlerInstrumentation.java
+74
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HandlerRegistrationInstrumentation.java
...gin/vertx3/define/HandlerRegistrationInstrumentation.java
+73
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplEndInstrumentation.java
...ertx3/define/HttpClientRequestImplEndInstrumentation.java
+80
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplHandleExceptionInstrumentation.java
.../HttpClientRequestImplHandleExceptionInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplHandleResponseInstrumentation.java
...e/HttpClientRequestImplHandleResponseInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpServerResponseImplEndInstrumentation.java
...rtx3/define/HttpServerResponseImplEndInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpServerResponseImplHandleExceptionInstrumentation.java
...HttpServerResponseImplHandleExceptionInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java
...plugin/vertx3/define/RouterImplAcceptInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def
...-core-3.x-plugin/src/main/resources/skywalking-plugin.def
+25
-0
docker/config/component-libraries.yml
docker/config/component-libraries.yml
+3
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+3
-0
oap-server/server-core/src/test/resources/component-libraries.yml
...er/server-core/src/test/resources/component-libraries.yml
+3
-0
oap-server/server-starter/src/main/resources/component-libraries.yml
...server-starter/src/main/resources/component-libraries.yml
+3
-0
未找到文件。
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
ce1c7aad
...
...
@@ -114,6 +114,8 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
ZOOKEEPER
=
new
OfficialComponent
(
58
,
"Zookeeper"
);
public
static
final
OfficialComponent
VERTX
=
new
OfficialComponent
(
59
,
"Vert.x"
);
private
static
ComponentsDefine
INSTANCE
=
new
ComponentsDefine
();
private
String
[]
components
;
...
...
@@ -123,7 +125,7 @@ public class ComponentsDefine {
}
public
ComponentsDefine
()
{
components
=
new
String
[
59
];
components
=
new
String
[
60
];
addComponent
(
TOMCAT
);
addComponent
(
HTTPCLIENT
);
addComponent
(
DUBBO
);
...
...
@@ -167,6 +169,7 @@ public class ComponentsDefine {
addComponent
(
REDISSON
);
addComponent
(
LETTUCE
);
addComponent
(
ZOOKEEPER
);
addComponent
(
VERTX
);
}
private
void
addComponent
(
OfficialComponent
component
)
{
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java
浏览文件 @
ce1c7aad
...
...
@@ -39,8 +39,8 @@ public interface AbstractSpan extends AsyncSpan {
AbstractSpan
setComponent
(
Component
component
);
/**
* Only use this method in explicit instrumentation, like opentracing-skywalking-bridge. It i
t higher recommen
d
*
don't use this for performance consideration
.
* Only use this method in explicit instrumentation, like opentracing-skywalking-bridge. It i
s highly recommende
d
*
not to use this method for performance reasons
.
*
* @param componentName
* @return the span for chaining.
...
...
@@ -127,7 +127,7 @@ public interface AbstractSpan extends AsyncSpan {
*/
void
ref
(
TraceSegmentRef
ref
);
AbstractSpan
start
(
long
start
t
ime
);
AbstractSpan
start
(
long
start
T
ime
);
AbstractSpan
setPeer
(
String
remotePeer
);
}
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
ce1c7aad
...
...
@@ -69,6 +69,7 @@
<module>
canal-1.x-plugin
</module>
<module>
dubbo-2.7.x-plugin
</module>
<module>
dubbo-2.7.x-conflict-patch
</module>
<module>
vertx-plugins
</module>
</modules>
<packaging>
pom
</packaging>
...
...
apm-sniffer/apm-sdk-plugin/vertx-plugins/pom.xml
0 → 100644
浏览文件 @
ce1c7aad
<?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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-sdk-plugin
</artifactId>
<version>
6.1.0-SNAPSHOT
</version>
</parent>
<artifactId>
vertx-plugins
</artifactId>
<modules>
<module>
vertx-core-3.x-plugin
</module>
</modules>
<packaging>
pom
</packaging>
<name>
vertx-plugins
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<sdk.plugin.related.dir>
/..
</sdk.plugin.related.dir>
</properties>
</project>
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/pom.xml
0 → 100644
浏览文件 @
ce1c7aad
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
vertx-plugins
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
6.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-vertx-core-3.x-plugin
</artifactId>
<packaging>
jar
</packaging>
<name>
vertx-core-3.x-plugin
</name>
<url>
http://maven.apache.org
</url>
<properties>
<vertx.version>
3.6.3
</vertx.version>
</properties>
<dependencies>
<dependency>
<groupId>
io.vertx
</groupId>
<artifactId>
vertx-core
</artifactId>
<version>
${vertx.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/ClusteredEventBusSendRemoteInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
io.vertx.core.eventbus.impl.clustered.ClusteredMessage
;
import
io.vertx.core.net.impl.ServerID
;
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.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
public
class
ClusteredEventBusSendRemoteInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ContextManager
.
getRuntimeContext
().
remove
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
ClusteredMessage
message
=
(
ClusteredMessage
)
allArguments
[
1
];
if
(
VertxContext
.
hasContext
(
message
.
address
()))
{
VertxContext
context
=
VertxContext
.
popContext
(
message
.
address
());
context
.
getSpan
().
asyncFinish
();
}
else
{
ServerID
sender
=
(
ServerID
)
allArguments
[
0
];
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
message
.
address
(),
contextCarrier
,
sender
.
toString
());
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asRPCFramework
(
span
);
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
message
.
headers
().
add
(
next
.
getHeadKey
(),
next
.
getHeadValue
());
}
if
(
message
.
replyAddress
()
!=
null
)
{
VertxContext
.
pushContext
(
message
.
replyAddress
(),
new
VertxContext
(
ContextManager
.
capture
(),
span
.
prepareForAsync
()));
}
ContextManager
.
getRuntimeContext
().
put
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
(),
true
);
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Boolean
closeSpan
=
(
Boolean
)
ContextManager
.
getRuntimeContext
().
get
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
if
(
Boolean
.
TRUE
.
equals
(
closeSpan
))
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/EventBusImplDeliverToHandlerInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
io.vertx.core.eventbus.Message
;
import
io.vertx.core.eventbus.impl.clustered.ClusteredMessage
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
EventBusImplDeliverToHandlerInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ContextManager
.
getRuntimeContext
().
remove
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
Message
message
=
(
Message
)
allArguments
[
0
];
boolean
isFromWire
=
message
instanceof
ClusteredMessage
&&
((
ClusteredMessage
)
message
).
isFromWire
();
if
(!
isFromWire
&&
VertxContext
.
hasContext
(
message
.
address
()))
{
VertxContext
context
=
VertxContext
.
popContext
(
message
.
address
());
context
.
getSpan
().
asyncFinish
();
}
else
if
(!
isFromWire
)
{
AbstractSpan
span
;
if
(
VertxContext
.
hasContext
(
message
.
replyAddress
()))
{
VertxContext
context
=
VertxContext
.
peekContext
(
message
.
replyAddress
());
span
=
ContextManager
.
createLocalSpan
(
context
.
getContextSnapshot
().
getParentOperationName
());
ContextManager
.
continued
(
context
.
getContextSnapshot
());
}
else
{
span
=
ContextManager
.
createLocalSpan
(
message
.
address
());
}
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asRPCFramework
(
span
);
if
(
message
.
replyAddress
()
!=
null
)
{
VertxContext
.
pushContext
(
message
.
replyAddress
(),
new
VertxContext
(
ContextManager
.
capture
(),
span
.
prepareForAsync
()));
}
ContextManager
.
getRuntimeContext
().
put
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
(),
true
);
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Boolean
closeSpan
=
(
Boolean
)
ContextManager
.
getRuntimeContext
().
get
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
if
(
Boolean
.
TRUE
.
equals
(
closeSpan
))
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HandlerRegistrationInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
io.vertx.core.eventbus.Message
;
import
io.vertx.core.eventbus.impl.clustered.ClusteredMessage
;
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.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HandlerRegistrationInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ContextManager
.
getRuntimeContext
().
remove
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
Message
message
=
(
Message
)
allArguments
[
1
];
if
(
VertxContext
.
hasContext
(
message
.
address
()))
{
VertxContext
context
=
VertxContext
.
popContext
(
message
.
address
());
context
.
getSpan
().
asyncFinish
();
}
else
{
AbstractSpan
span
;
boolean
isFromWire
=
message
instanceof
ClusteredMessage
&&
((
ClusteredMessage
)
message
).
isFromWire
();
if
(
isFromWire
)
{
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
next
.
setHeadValue
(
message
.
headers
().
get
(
next
.
getHeadKey
()));
message
.
headers
().
remove
(
next
.
getHeadKey
());
}
span
=
ContextManager
.
createEntrySpan
(
message
.
address
(),
contextCarrier
);
}
else
{
if
(
VertxContext
.
hasContext
(
message
.
replyAddress
()))
{
VertxContext
context
=
VertxContext
.
peekContext
(
message
.
replyAddress
());
span
=
ContextManager
.
createLocalSpan
(
context
.
getContextSnapshot
().
getParentOperationName
());
ContextManager
.
continued
(
context
.
getContextSnapshot
());
}
else
{
span
=
ContextManager
.
createLocalSpan
(
message
.
address
());
}
}
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asRPCFramework
(
span
);
if
(
message
.
replyAddress
()
!=
null
)
{
VertxContext
.
pushContext
(
message
.
replyAddress
(),
new
VertxContext
(
ContextManager
.
capture
(),
span
.
prepareForAsync
()));
}
ContextManager
.
getRuntimeContext
().
put
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
(),
true
);
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Boolean
closeSpan
=
(
Boolean
)
ContextManager
.
getRuntimeContext
().
get
(
VertxContext
.
STOP_SPAN_NECESSARY
+
"."
+
getClass
().
getName
());
if
(
Boolean
.
TRUE
.
equals
(
closeSpan
))
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
io.vertx.core.http.HttpClientRequest
;
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.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplEndInterceptor
implements
InstanceMethodsAroundInterceptor
,
InstanceConstructorInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
{
String
host
;
int
port
;
if
(
allArguments
[
3
]
instanceof
Integer
)
{
host
=
(
String
)
allArguments
[
2
];
port
=
(
Integer
)
allArguments
[
3
];
}
else
{
host
=
(
String
)
allArguments
[
3
];
port
=
(
Integer
)
allArguments
[
4
];
}
objInst
.
setSkyWalkingDynamicField
(
host
+
":"
+
port
);
}
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
HttpClientRequest
request
=
(
HttpClientRequest
)
objInst
;
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
toPath
(
request
.
uri
()),
contextCarrier
,
(
String
)
objInst
.
getSkyWalkingDynamicField
());
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asHttp
(
span
);
Tags
.
HTTP
.
METHOD
.
set
(
span
,
request
.
method
().
toString
());
Tags
.
URL
.
set
(
span
,
request
.
uri
());
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
request
.
headers
().
add
(
next
.
getHeadKey
(),
next
.
getHeadValue
());
}
objInst
.
setSkyWalkingDynamicField
(
new
VertxContext
(
ContextManager
.
capture
(),
span
.
prepareForAsync
()));
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
private
static
String
toPath
(
String
uri
)
{
if
(
uri
.
contains
(
"?"
))
{
return
uri
.
substring
(
0
,
uri
.
indexOf
(
"?"
));
}
else
{
return
uri
;
}
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleExceptionInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplHandleExceptionInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
VertxContext
context
=
(
VertxContext
)
objInst
.
getSkyWalkingDynamicField
();
context
.
getSpan
().
errorOccurred
().
log
((
Throwable
)
allArguments
[
0
]);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplHandleResponseInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplHandleResponseInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
VertxContext
context
=
(
VertxContext
)
objInst
.
getSkyWalkingDynamicField
();
context
.
getSpan
().
asyncFinish
();
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
"#"
+
context
.
getSpan
().
getOperationName
());
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asHttp
(
span
);
ContextManager
.
continued
(
context
.
getContextSnapshot
());
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplEndInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HttpServerResponseImplEndInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
if
(
allArguments
.
length
==
0
)
{
VertxContext
context
=
(
VertxContext
)
objInst
.
getSkyWalkingDynamicField
();
context
.
getSpan
().
asyncFinish
();
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpServerResponseImplHandleExceptionInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
HttpServerResponseImplHandleExceptionInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
VertxContext
context
=
(
VertxContext
)
objInst
.
getSkyWalkingDynamicField
();
context
.
getSpan
().
errorOccurred
().
log
((
Throwable
)
allArguments
[
0
]);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
io.vertx.core.http.HttpServerRequest
;
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.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* @author brandon.fergerson
*/
public
class
RouterImplAcceptInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
HttpServerRequest
request
=
(
HttpServerRequest
)
allArguments
[
0
];
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
next
.
setHeadValue
(
request
.
headers
().
get
(
next
.
getHeadKey
()));
request
.
headers
().
remove
(
next
.
getHeadKey
());
}
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
toPath
(
request
.
uri
()),
contextCarrier
);
span
.
setComponent
(
ComponentsDefine
.
VERTX
);
SpanLayer
.
asHttp
(
span
);
Tags
.
HTTP
.
METHOD
.
set
(
span
,
request
.
method
().
toString
());
Tags
.
URL
.
set
(
span
,
request
.
uri
());
((
EnhancedInstance
)
request
.
response
()).
setSkyWalkingDynamicField
(
new
VertxContext
(
ContextManager
.
capture
(),
span
.
prepareForAsync
()));
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
private
static
String
toPath
(
String
uri
)
{
if
(
uri
.
contains
(
"?"
))
{
return
uri
.
substring
(
0
,
uri
.
indexOf
(
"?"
));
}
else
{
return
uri
;
}
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/VertxContext.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3
;
import
org.apache.skywalking.apm.agent.core.context.ContextSnapshot
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
java.util.Map
;
import
java.util.Stack
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author brandon.fergerson
*/
class
VertxContext
{
public
static
final
String
STOP_SPAN_NECESSARY
=
"VERTX_STOP_SPAN_NECESSARY"
;
private
static
final
Map
<
String
,
Stack
<
VertxContext
>>
CONTEXT_MAP
=
new
ConcurrentHashMap
<
String
,
Stack
<
VertxContext
>>();
static
void
pushContext
(
String
identifier
,
VertxContext
vertxContext
)
{
if
(!
CONTEXT_MAP
.
containsKey
(
identifier
))
{
CONTEXT_MAP
.
put
(
identifier
,
new
Stack
<
VertxContext
>());
}
CONTEXT_MAP
.
get
(
identifier
).
push
(
vertxContext
);
}
static
VertxContext
popContext
(
String
identifier
)
{
final
Stack
<
VertxContext
>
stack
=
CONTEXT_MAP
.
get
(
identifier
);
final
VertxContext
context
=
stack
.
pop
();
if
(
stack
.
isEmpty
())
{
CONTEXT_MAP
.
remove
(
identifier
);
}
return
context
;
}
static
VertxContext
peekContext
(
String
identifier
)
{
return
CONTEXT_MAP
.
get
(
identifier
).
peek
();
}
static
boolean
hasContext
(
String
identifier
)
{
return
identifier
!=
null
&&
CONTEXT_MAP
.
containsKey
(
identifier
);
}
private
final
ContextSnapshot
contextSnapshot
;
private
final
AbstractSpan
span
;
VertxContext
(
ContextSnapshot
contextSnapshot
,
AbstractSpan
span
)
{
this
.
contextSnapshot
=
contextSnapshot
;
this
.
span
=
span
;
}
ContextSnapshot
getContextSnapshot
()
{
return
contextSnapshot
;
}
AbstractSpan
getSpan
()
{
return
span
;
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/ClusteredEventBusSendRemoteInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link ClusteredEventBusSendRemoteInstrumentation} enhance the <code>sendRemote</code> method
* in <code>io.vertx.core.eventbus.impl.clustered.ClusteredEventBus</code> class by
* <code>ClusteredEventBusSendRemoteInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
ClusteredEventBusSendRemoteInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.eventbus.impl.clustered.ClusteredEventBus"
;
private
static
final
String
ENHANCE_METHOD
=
"sendRemote"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.ClusteredEventBusSendRemoteInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]{
"io.vertx.core.eventbus.impl.clustered.ClusteredMessage"
};
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/EventBusImplDeliverToHandlerInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link EventBusImplDeliverToHandlerInstrumentation} enhance the <code>deliverToHandler</code> method
* in <code>io.vertx.core.eventbus.impl.EventBusImpl</code> class by
* <code>EventBusImplDeliverToHandlerInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
EventBusImplDeliverToHandlerInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.eventbus.impl.EventBusImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"deliverToHandler"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.EventBusImplDeliverToHandlerInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]{
"io.vertx.core.eventbus.impl.clustered.ClusteredMessage"
};
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HandlerRegistrationInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HandlerRegistrationInstrumentation} enhance the <code>deliver</code> and <code>handleMessage</code> methods
* in <code>io.vertx.core.eventbus.impl.HandlerRegistration</code> class by
* <code>HandlerRegistrationInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HandlerRegistrationInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.eventbus.impl.HandlerRegistration"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HandlerRegistrationInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"deliver"
).
or
(
named
(
"handleMessage"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]{
"io.vertx.core.eventbus.impl.clustered.ClusteredMessage"
};
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplEndInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HttpClientRequestImplEndInstrumentation} enhance the <code>end</code> method
* in <code>io.vertx.core.http.impl.HttpClientRequestImpl</code> class by
* <code>HttpClientRequestImplEndInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplEndInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.http.impl.HttpClientRequestImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"end"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HttpClientRequestImplEndInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[]
{
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
any
();
}
@Override
public
String
getConstructorInterceptor
()
{
return
INTERCEPT_CLASS
;
}
}
};
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplHandleExceptionInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HttpClientRequestImplHandleExceptionInstrumentation} enhance the <code>handleException</code> method
* in <code>io.vertx.core.http.impl.HttpClientRequestBase</code> class by
* <code>HttpClientRequestImplHandleExceptionInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplHandleExceptionInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.http.impl.HttpClientRequestImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"handleException"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HttpClientRequestImplHandleExceptionInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpClientRequestImplHandleResponseInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HttpClientRequestImplHandleResponseInstrumentation} enhance the <code>handleResponse</code> method
* in <code>io.vertx.core.http.impl.HttpClientRequestImpl</code> class by
* <code>HttpClientRequestImplHandleResponseInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HttpClientRequestImplHandleResponseInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.http.impl.HttpClientRequestImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"handleResponse"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HttpClientRequestImplHandleResponseInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpServerResponseImplEndInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HttpServerResponseImplEndInstrumentation} enhance the <code>end</code> method
* in <code>io.vertx.core.http.impl.HttpServerResponseImpl</code> class by
* <code>HttpServerResponseImplEndInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HttpServerResponseImplEndInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.http.impl.HttpServerResponseImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"end"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HttpServerResponseImplEndInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/HttpServerResponseImplHandleExceptionInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link HttpServerResponseImplHandleExceptionInstrumentation} enhance the <code>handleException</code> method
* in <code>io.vertx.core.http.impl.HttpServerResponseImpl</code> class by
* <code>HttpServerResponseImplHandleExceptionInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
HttpServerResponseImplHandleExceptionInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.core.http.impl.HttpServerResponseImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"handleException"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.HttpServerResponseImplHandleExceptionInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/define/RouterImplAcceptInstrumentation.java
0 → 100644
浏览文件 @
ce1c7aad
/*
* 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.plugin.vertx3.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* {@link RouterImplAcceptInstrumentation} enhance the <code>accept</code> method
* in <code>io.vertx.core.http.impl.HttpServerRequestImpl</code> class by
* <code>RouterImplAcceptInterceptor</code> class
*
* @author brandon.fergerson
*/
public
class
RouterImplAcceptInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"io.vertx.ext.web.impl.RouterImpl"
;
private
static
final
String
ENHANCE_METHOD
=
"accept"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.vertx3.RouterImplAcceptInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
ce1c7aad
# 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.
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.ClusteredEventBusSendRemoteInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.EventBusImplDeliverToHandlerInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HandlerRegistrationInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpClientRequestImplEndInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpClientRequestImplHandleExceptionInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpClientRequestImplHandleResponseInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerResponseImplEndInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.HttpServerResponseImplHandleExceptionInstrumentation
vertx-core-3.x=org.apache.skywalking.apm.plugin.vertx3.define.RouterImplAcceptInstrumentation
docker/config/component-libraries.yml
浏览文件 @
ce1c7aad
...
...
@@ -204,6 +204,9 @@ Lettuce:
Zookeeper
:
id
:
58
languages
:
Java
Vertx
:
id
:
59
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
ce1c7aad
...
...
@@ -63,6 +63,9 @@
*
[
Canal: Alibaba mysql database binlog incremental subscription & consumer components
](
https://github.com/alibaba/canal
)
1.0.25 -> 1.1.2
*
JSON
*
[
GSON
](
https://github.com/google/gson
)
2.8.x (Optional²)
*
Vert.x Ecosystem
*
Vert.x Eventbus 3.2+
*
Vert.x Web 3.x
¹Due to license incompatibilities/restrictions these plugins are hosted and released in 3rd part repository,
go to
[
SkyAPM java plugin extension repository
](
https://github.com/SkyAPM/java-plugin-extensions
)
to get these.
...
...
oap-server/server-core/src/test/resources/component-libraries.yml
浏览文件 @
ce1c7aad
...
...
@@ -186,6 +186,9 @@ Lettuce:
Zookeeper
:
id
:
58
languages
:
Java
Vertx
:
id
:
59
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
oap-server/server-starter/src/main/resources/component-libraries.yml
浏览文件 @
ce1c7aad
...
...
@@ -204,6 +204,9 @@ Lettuce:
Zookeeper
:
id
:
58
languages
:
Java
Vertx
:
id
:
59
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录