Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
bb0b3d36
S
SkyWalking
项目概览
killuaz丶x
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
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,发现更多精彩内容 >>
提交
bb0b3d36
编写于
9月 13, 2019
作者:
S
stone.wlg
提交者:
wu-sheng
9月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
provide cassandra java driver 3.x plugin (#3410)
* add cassandra java driver 3.x plugin
上级
919988fa
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
944 addition
and
2 deletion
+944
-2
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+2
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/pom.xml
...r/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/pom.xml
+46
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConnectInterceptor.java
...n/cassandra/java/driver/v3/ClusterConnectInterceptor.java
+58
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConstructorWithStateListenerArgInterceptor.java
...v3/ClusterConstructorWithStateListenerArgInterceptor.java
+48
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ConnectionInfo.java
...g/apm/plugin/cassandra/java/driver/v3/ConnectionInfo.java
+44
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/Constants.java
...alking/apm/plugin/cassandra/java/driver/v3/Constants.java
+27
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/DefaultResultSetFutureGetUninterruptiblyInterceptor.java
.../DefaultResultSetFutureGetUninterruptiblyInterceptor.java
+61
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor.java
...gerExecuteAndExecuteAsyncWithStatementArgInterceptor.java
+84
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/ClusterInstrumentation.java
...ssandra/java/driver/v3/define/ClusterInstrumentation.java
+84
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/DefaultResultSetFutureInstrumentation.java
...iver/v3/define/DefaultResultSetFutureInstrumentation.java
+71
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/SessionManagerInstrumentation.java
.../java/driver/v3/define/SessionManagerInstrumentation.java
+72
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/resources/skywalking-plugin.def
...river-3.x-plugin/src/main/resources/skywalking-plugin.def
+19
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConnectInterceptorTest.java
...ssandra/java/driver/v3/ClusterConnectInterceptorTest.java
+68
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConstructorWithStateListenerArgInterceptorTest.java
...lusterConstructorWithStateListenerArgInterceptorTest.java
+74
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/DefaultResultSetFutureGetUninterruptiblyInterceptorTest.java
...aultResultSetFutureGetUninterruptiblyInterceptorTest.java
+79
-0
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptorTest.java
...xecuteAndExecuteAsyncWithStatementArgInterceptorTest.java
+88
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+2
-0
oap-server/server-core/src/test/resources/component-libraries.yml
...er/server-core/src/test/resources/component-libraries.yml
+8
-1
oap-server/server-starter/src/main/resources/component-libraries.yml
...server-starter/src/main/resources/component-libraries.yml
+8
-1
未找到文件。
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
bb0b3d36
...
@@ -132,4 +132,6 @@ public class ComponentsDefine {
...
@@ -132,4 +132,6 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
PLAY
=
new
OfficialComponent
(
68
,
"Play"
);
public
static
final
OfficialComponent
PLAY
=
new
OfficialComponent
(
68
,
"Play"
);
public
static
final
OfficialComponent
CASSANDRA_JAVA_DRIVER
=
new
OfficialComponent
(
69
,
"cassandra-java-driver"
);
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/pom.xml
0 → 100644
浏览文件 @
bb0b3d36
<!--
~ 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>
apm-sdk-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
6.5.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-cassandra-java-driver-3.x-plugin
</artifactId>
<name>
apm-cassandra-java-driver-3.x-plugin
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<cassandra.version>
3.7.2
</cassandra.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.datastax.cassandra
</groupId>
<artifactId>
cassandra-driver-core
</artifactId>
<version>
${cassandra.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConnectInterceptor.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
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.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 stone.wlg
*/
public
class
ClusterConnectInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
if
(
ret
instanceof
EnhancedInstance
)
{
String
keyspace
=
allArguments
.
length
>
0
?
(
String
)
allArguments
[
0
]
:
null
;
ConnectionInfo
connectionInfo
=
(
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
();
connectionInfo
.
setKeyspace
(
keyspace
);
((
EnhancedInstance
)
ret
).
setSkyWalkingDynamicField
(
connectionInfo
);
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
if
(
ContextManager
.
isActive
())
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
t
);
}
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConstructorWithStateListenerArgInterceptor.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor
;
import
java.net.InetSocketAddress
;
import
java.util.List
;
/**
* @author stone.wlg
*/
public
class
ClusterConstructorWithStateListenerArgInterceptor
implements
InstanceConstructorInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
{
List
<
InetSocketAddress
>
inetSocketAddresses
=
(
List
<
InetSocketAddress
>)
allArguments
[
1
];
StringBuilder
hosts
=
new
StringBuilder
();
for
(
InetSocketAddress
inetSocketAddress
:
inetSocketAddresses
)
{
hosts
.
append
(
inetSocketAddress
.
getHostName
()
+
":"
+
inetSocketAddress
.
getPort
()
+
","
);
}
String
contactPoints
=
hosts
.
toString
();
if
(
contactPoints
.
length
()
>
0
)
{
contactPoints
=
contactPoints
.
substring
(
0
,
contactPoints
.
length
()
-
1
);
}
objInst
.
setSkyWalkingDynamicField
(
new
ConnectionInfo
(
contactPoints
)
);
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ConnectionInfo.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
/**
* @author stone.wlg
*/
public
class
ConnectionInfo
{
private
final
String
contactPoints
;
private
String
keyspace
;
public
ConnectionInfo
(
final
String
contactPoints
)
{
this
.
contactPoints
=
contactPoints
;
}
public
String
getKeyspace
()
{
return
this
.
keyspace
;
}
public
void
setKeyspace
(
String
keyspace
)
{
this
.
keyspace
=
keyspace
;
}
public
String
getContactPoints
()
{
return
this
.
contactPoints
;
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/Constants.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
/**
* @author stone.wlg
*/
public
class
Constants
{
public
static
final
String
CASSANDRA_OP_PREFIX
=
"Cassandra/"
;
public
static
final
String
CASSANDRA_DB_TYPE
=
"cassandra"
;
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/DefaultResultSetFutureGetUninterruptiblyInterceptor.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
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 stone.wlg
*/
public
class
DefaultResultSetFutureGetUninterruptiblyInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
Constants
.
CASSANDRA_OP_PREFIX
+
method
.
getName
());
span
.
setComponent
(
ComponentsDefine
.
CASSANDRA_JAVA_DRIVER
);
Tags
.
DB_TYPE
.
set
(
span
,
Constants
.
CASSANDRA_DB_TYPE
);
SpanLayer
.
asDB
(
span
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
if
(
ContextManager
.
isActive
())
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
if
(
ContextManager
.
isActive
())
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
t
);
}
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
com.datastax.driver.core.BoundStatement
;
import
com.datastax.driver.core.Statement
;
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 stone.wlg
*/
public
class
SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
final
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ConnectionInfo
connectionInfo
=
(
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
();
if
(
connectionInfo
==
null
)
{
return
;
}
Statement
statement
=
(
Statement
)
allArguments
[
0
];
String
remotePeer
=
statement
.
getHost
()
==
null
?
connectionInfo
.
getContactPoints
()
:
(
statement
.
getHost
().
getSocketAddress
().
getHostName
()
+
":"
+
statement
.
getHost
().
getSocketAddress
().
getPort
());
String
keyspace
=
statement
.
getKeyspace
()
==
null
?
connectionInfo
.
getKeyspace
()
:
statement
.
getKeyspace
();
String
query
=
statement
.
toString
();
if
(
statement
instanceof
BoundStatement
)
{
query
=
((
BoundStatement
)
statement
).
preparedStatement
().
getQueryString
();
}
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
Constants
.
CASSANDRA_OP_PREFIX
+
method
.
getName
(),
remotePeer
);
span
.
setComponent
(
ComponentsDefine
.
CASSANDRA_JAVA_DRIVER
);
Tags
.
DB_TYPE
.
set
(
span
,
Constants
.
CASSANDRA_DB_TYPE
);
Tags
.
DB_INSTANCE
.
set
(
span
,
keyspace
);
Tags
.
DB_STATEMENT
.
set
(
span
,
query
);
SpanLayer
.
asDB
(
span
);
}
@Override
public
final
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ConnectionInfo
connectionInfo
=
(
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
();
if
(
connectionInfo
!=
null
&&
ContextManager
.
isActive
())
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
final
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
if
(
ContextManager
.
isActive
())
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
t
);
}
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/ClusterInstrumentation.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
/**
* @author stone.wlg
*/
public
class
ClusterInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"com.datastax.driver.core.Cluster"
;
private
static
final
String
CONSTRUCTOR_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.ClusterConstructorWithStateListenerArgInterceptor"
;
private
static
final
String
METHODS_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.ClusterConnectInterceptor"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[]{
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
4
);
}
@Override
public
String
getConstructorInterceptor
()
{
return
CONSTRUCTOR_INTERCEPT_CLASS
;
}
}
};
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"connect"
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
METHODS_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/DefaultResultSetFutureInstrumentation.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
/**
* @author stone.wlg
*/
public
class
DefaultResultSetFutureInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"com.datastax.driver.core.DefaultResultSetFuture"
;
private
static
final
String
METHODS_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.DefaultResultSetFutureGetUninterruptiblyInterceptor"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
null
;
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"getUninterruptibly"
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
METHODS_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/define/SessionManagerInstrumentation.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
bytebuddy
.
ArgumentTypeNameMatch
.
takesArgumentWithType
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
/**
* @author stone.wlg
*/
public
class
SessionManagerInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"com.datastax.driver.core.SessionManager"
;
private
static
final
String
METHODS_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
null
;
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
and
(
takesArgumentWithType
(
0
,
"com.datastax.driver.core.Statement"
))
.
or
(
named
(
"executeAsync"
).
and
(
takesArgumentWithType
(
0
,
"com.datastax.driver.core.Statement"
)));
}
@Override
public
String
getMethodsInterceptor
()
{
return
METHODS_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
bb0b3d36
# 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.
cassandra-java-driver-3.x=org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.define.ClusterInstrumentation
cassandra-java-driver-3.x=org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.define.SessionManagerInstrumentation
cassandra-java-driver-3.x=org.apache.skywalking.apm.plugin.cassandra.java.driver.v3.define.DefaultResultSetFutureInstrumentation
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConnectInterceptorTest.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.hamcrest.core.Is
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
java.lang.reflect.Method
;
/**
* @author stone.wlg
*/
@RunWith
(
PowerMockRunner
.
class
)
public
class
ClusterConnectInterceptorTest
{
private
ClusterConnectInterceptor
interceptor
;
private
EnhancedInstance
enhancedInstance
=
new
EnhancedInstance
()
{
private
ConnectionInfo
connectionInfo
=
new
ConnectionInfo
(
"localhost:9042"
);
@Override
public
Object
getSkyWalkingDynamicField
()
{
return
connectionInfo
;
}
@Override
public
void
setSkyWalkingDynamicField
(
Object
value
)
{
this
.
connectionInfo
=
(
ConnectionInfo
)
value
;
}
};
@Mock
private
Method
method
;
@Before
public
void
setUp
()
throws
Exception
{
interceptor
=
new
ClusterConnectInterceptor
();
}
@Test
public
void
afterMethod
()
throws
Throwable
{
EnhancedInstance
ret
=
(
EnhancedInstance
)
interceptor
.
afterMethod
(
enhancedInstance
,
method
,
new
Object
[]{
"test"
},
null
,
enhancedInstance
);
ConnectionInfo
connectionInfo
=
(
ConnectionInfo
)
ret
.
getSkyWalkingDynamicField
();
Assert
.
assertThat
(
connectionInfo
.
getKeyspace
(),
Is
.
is
(
"test"
));
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/ClusterConstructorWithStateListenerArgInterceptorTest.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.hamcrest.core.Is
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
java.net.InetSocketAddress
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author stone.wlg
*/
@RunWith
(
PowerMockRunner
.
class
)
public
class
ClusterConstructorWithStateListenerArgInterceptorTest
{
@Mock
private
ClusterConstructorWithStateListenerArgInterceptor
interceptor
;
@Mock
private
EnhancedInstance
enhancedInstance
=
new
EnhancedInstance
()
{
private
ConnectionInfo
connectionInfo
;
@Override
public
Object
getSkyWalkingDynamicField
()
{
return
connectionInfo
;
}
@Override
public
void
setSkyWalkingDynamicField
(
Object
value
)
{
this
.
connectionInfo
=
(
ConnectionInfo
)
value
;
}
};
private
List
<
InetSocketAddress
>
inetSocketAddresses
;
@Before
public
void
setUp
()
throws
Exception
{
interceptor
=
new
ClusterConstructorWithStateListenerArgInterceptor
();
inetSocketAddresses
=
new
ArrayList
<
InetSocketAddress
>();
inetSocketAddresses
.
add
(
new
InetSocketAddress
(
"172.20.0.2"
,
9042
));
}
@Test
public
void
onConstruct
()
{
interceptor
.
onConstruct
(
enhancedInstance
,
new
Object
[]{
"cluster-name"
,
inetSocketAddresses
});
ConnectionInfo
connectionInfo
=
(
ConnectionInfo
)
enhancedInstance
.
getSkyWalkingDynamicField
();
Assert
.
assertThat
(
connectionInfo
.
getContactPoints
(),
Is
.
is
(
"172.20.0.2:9042"
));
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/DefaultResultSetFutureGetUninterruptiblyInterceptorTest.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.test.helper.SegmentHelper
;
import
org.apache.skywalking.apm.agent.test.tools.*
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
java.lang.reflect.Method
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
powermock
.
api
.
mockito
.
PowerMockito
.
when
;
/**
* @author stone.wlg
*/
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
TracingSegmentRunner
.
class
)
public
class
DefaultResultSetFutureGetUninterruptiblyInterceptorTest
{
@Rule
public
AgentServiceRule
serviceRule
=
new
AgentServiceRule
();
@SegmentStoragePoint
private
SegmentStorage
segmentStorage
;
private
DefaultResultSetFutureGetUninterruptiblyInterceptor
interceptor
;
@Mock
private
EnhancedInstance
objectInstance
;
@Mock
private
Method
method
;
@Before
public
void
setUp
()
throws
Exception
{
interceptor
=
new
DefaultResultSetFutureGetUninterruptiblyInterceptor
();
when
(
method
.
getName
()).
thenReturn
(
"executeAsync"
);
}
@Test
public
void
testCreateLocalSpan
()
throws
Throwable
{
interceptor
.
beforeMethod
(
objectInstance
,
method
,
null
,
null
,
null
);
interceptor
.
afterMethod
(
objectInstance
,
method
,
null
,
null
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
segment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
assertThat
(
SegmentHelper
.
getSpans
(
segment
).
size
(),
is
(
1
));
AbstractTracingSpan
span
=
SegmentHelper
.
getSpans
(
segment
).
get
(
0
);
SpanAssert
.
assertLayer
(
span
,
SpanLayer
.
DB
);
assertThat
(
span
.
getOperationName
(),
is
(
Constants
.
CASSANDRA_OP_PREFIX
));
SpanAssert
.
assertTag
(
span
,
0
,
Constants
.
CASSANDRA_DB_TYPE
);
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/cassandra-java-driver-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/cassandra/java/driver/v3/SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptorTest.java
0 → 100644
浏览文件 @
bb0b3d36
/*
* 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.cassandra.java.driver.v3
;
import
com.datastax.driver.core.SimpleStatement
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.test.helper.SegmentHelper
;
import
org.apache.skywalking.apm.agent.test.tools.*
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
java.lang.reflect.Method
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
powermock
.
api
.
mockito
.
PowerMockito
.
when
;
/**
* @author stone.wlg
*/
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
TracingSegmentRunner
.
class
)
public
class
SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptorTest
{
@Rule
public
AgentServiceRule
serviceRule
=
new
AgentServiceRule
();
@SegmentStoragePoint
private
SegmentStorage
segmentStorage
;
private
SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor
interceptor
;
@Mock
private
ConnectionInfo
connectionInfo
;
@Mock
private
EnhancedInstance
objectInstance
;
@Mock
private
Method
method
;
@Before
public
void
setUp
()
throws
Exception
{
interceptor
=
new
SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor
();
when
(
objectInstance
.
getSkyWalkingDynamicField
()).
thenReturn
(
connectionInfo
);
when
(
method
.
getName
()).
thenReturn
(
"executeAsync"
);
when
(
connectionInfo
.
getContactPoints
()).
thenReturn
(
"localhost:9042"
);
when
(
connectionInfo
.
getKeyspace
()).
thenReturn
(
"test"
);
}
@Test
public
void
testCreateExitSpan
()
throws
Throwable
{
interceptor
.
beforeMethod
(
objectInstance
,
method
,
new
Object
[]{
new
SimpleStatement
(
"SELECT * FROM test"
)},
null
,
null
);
interceptor
.
afterMethod
(
objectInstance
,
method
,
new
Object
[]{
new
SimpleStatement
(
"SELECT * FROM test"
)},
null
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
segment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
assertThat
(
SegmentHelper
.
getSpans
(
segment
).
size
(),
is
(
1
));
AbstractTracingSpan
span
=
SegmentHelper
.
getSpans
(
segment
).
get
(
0
);
SpanAssert
.
assertLayer
(
span
,
SpanLayer
.
DB
);
assertThat
(
span
.
getOperationName
(),
is
(
Constants
.
CASSANDRA_OP_PREFIX
));
SpanAssert
.
assertTag
(
span
,
0
,
Constants
.
CASSANDRA_DB_TYPE
);
SpanAssert
.
assertTag
(
span
,
1
,
"test"
);
SpanAssert
.
assertTag
(
span
,
2
,
"SELECT * FROM test"
);
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
bb0b3d36
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
<module>
vertx-plugins
</module>
<module>
vertx-plugins
</module>
<module>
resteasy-plugin
</module>
<module>
resteasy-plugin
</module>
<module>
solrj-7.x-plugin
</module>
<module>
solrj-7.x-plugin
</module>
<module>
cassandra-java-driver-3.x-plugin
</module>
</modules>
</modules>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
bb0b3d36
...
@@ -56,6 +56,8 @@
...
@@ -56,6 +56,8 @@
*
[
transport-client
](
https://github.com/elastic/elasticsearch/tree/master/client/transport
)
5.2.x-5.6.x
*
[
transport-client
](
https://github.com/elastic/elasticsearch/tree/master/client/transport
)
5.2.x-5.6.x
*
[
Solr
](
https://github.com/apache/lucene-solr/
)
*
[
Solr
](
https://github.com/apache/lucene-solr/
)
*
[
SolrJ
](
https://github.com/apache/lucene-solr/tree/master/solr/solrj
)
7.x
*
[
SolrJ
](
https://github.com/apache/lucene-solr/tree/master/solr/solrj
)
7.x
*
[
Cassandra
](
https://github.com/apache/cassandra
)
3.x
*
[
cassandra-java-driver
](
https://github.com/datastax/java-driver
)
3.6.0-3.7.2
*
Service Discovery
*
Service Discovery
*
[
Netflix Eureka
](
https://github.com/Netflix/eureka
)
*
[
Netflix Eureka
](
https://github.com/Netflix/eureka
)
...
...
oap-server/server-core/src/test/resources/component-libraries.yml
浏览文件 @
bb0b3d36
...
@@ -215,6 +215,12 @@ spring-webflux:
...
@@ -215,6 +215,12 @@ spring-webflux:
Play
:
Play
:
id
:
68
id
:
68
languages
:
Java,Scala
languages
:
Java,Scala
cassandra-java-driver
:
id
:
69
languages
:
Java
Cassandra
:
id
:
70
languages
:
Java
# .NET/.NET Core components
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
# [3000, 4000) for C#/.NET only
...
@@ -312,4 +318,5 @@ Component-Server-Mappings:
...
@@ -312,4 +318,5 @@ Component-Server-Mappings:
Pomelo.EntityFrameworkCore.MySql
:
Mysql
Pomelo.EntityFrameworkCore.MySql
:
Mysql
Npgsql.EntityFrameworkCore.PostgreSQL
:
PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
:
PostgreSQL
transport-client
:
Elasticsearch
transport-client
:
Elasticsearch
SolrJ
:
Solr
SolrJ
:
Solr
\ No newline at end of file
cassandra-java-driver
:
Cassandra
\ No newline at end of file
oap-server/server-starter/src/main/resources/component-libraries.yml
浏览文件 @
bb0b3d36
...
@@ -233,6 +233,12 @@ spring-webflux:
...
@@ -233,6 +233,12 @@ spring-webflux:
Play
:
Play
:
id
:
68
id
:
68
languages
:
Java,Scala
languages
:
Java,Scala
cassandra-java-driver
:
id
:
69
languages
:
Java
Cassandra
:
id
:
70
languages
:
Java
# .NET/.NET Core components
# .NET/.NET Core components
...
@@ -333,4 +339,5 @@ Component-Server-Mappings:
...
@@ -333,4 +339,5 @@ Component-Server-Mappings:
Pomelo.EntityFrameworkCore.MySql
:
Mysql
Pomelo.EntityFrameworkCore.MySql
:
Mysql
Npgsql.EntityFrameworkCore.PostgreSQL
:
PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
:
PostgreSQL
transport-client
:
Elasticsearch
transport-client
:
Elasticsearch
SolrJ
:
Solr
SolrJ
:
Solr
\ No newline at end of file
cassandra-java-driver
:
Cassandra
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录