提交DubboxRest测试工程以及修复部分bug
This commit is contained in:
parent
eaf14c6a49
commit
6c7726ab31
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>skywalking-example</artifactId>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<version>1.0-Final</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>example-dubbox-rest</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-client</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson-provider</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>8.0.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-logging-juli</artifactId>
|
||||
<version>8.0.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbox</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.20.0-GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.101tec</groupId>
|
||||
<artifactId>zkclient</artifactId>
|
||||
<version>0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>4.3.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>4.3.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.192</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>4.3.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ai.cloud.skywalking.sample.dubboxrest;
|
||||
|
||||
import com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA;
|
||||
import com.ai.cloud.skywalking.sample.dubboxrest.interfaces.param.DubboxRestInterAParameter;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class DubboxRestConsumer {
|
||||
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:consumer/dubbox-rest-consumer.xml");
|
||||
IDubboxRestInterA dubboxRestInterA = context.getBean(IDubboxRestInterA.class);
|
||||
System.out.println(dubboxRestInterA.doBusiness(new DubboxRestInterAParameter("AAAAA")));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ai.cloud.skywalking.sample.dubboxrest;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class DubboxRestStart {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext =
|
||||
new ClassPathXmlApplicationContext("classpath*:spring-context.xml");
|
||||
classPathXmlApplicationContext.start();
|
||||
|
||||
while (true) {
|
||||
Thread.sleep(100000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.ai.cloud.skywalking.sample.dubboxrest.impl;
|
||||
|
||||
import com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA;
|
||||
import com.ai.cloud.skywalking.sample.dubboxrest.interfaces.param.DubboxRestInterAParameter;
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class DubboxRestInterAImpl implements IDubboxRestInterA {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
public String doBusiness(DubboxRestInterAParameter paramA) {
|
||||
try {
|
||||
Connection connection = dataSource.getConnection();
|
||||
PreparedStatement preparedStatement =
|
||||
connection.prepareStatement("INSERT INTO PUBLIC.sampletable1(key1,value1) VALUES(?,?)");
|
||||
preparedStatement.setString(1, UUID.randomUUID().toString());
|
||||
preparedStatement.setString(2, paramA.getParameterA());
|
||||
int updateCount = preparedStatement.executeUpdate();
|
||||
return "{\"updateCount\":\"" + updateCount + "\"}";
|
||||
} catch (SQLException e) {
|
||||
return "{\"Message\":\"Update failed\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.ai.cloud.skywalking.sample.dubboxrest.interfaces;
|
||||
|
||||
|
||||
import com.ai.cloud.skywalking.sample.dubboxrest.interfaces.param.DubboxRestInterAParameter;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
@Path("/rest-a")
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
|
||||
public interface IDubboxRestInterA {
|
||||
|
||||
@Path("/doBusiness")
|
||||
@POST
|
||||
String doBusiness(DubboxRestInterAParameter paramA);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ai.cloud.skywalking.sample.dubboxrest.interfaces.param;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DubboxRestInterAParameter {
|
||||
|
||||
public DubboxRestInterAParameter() {
|
||||
}
|
||||
|
||||
@XmlElement(name = "parameterA")
|
||||
private String parameterA;
|
||||
|
||||
public DubboxRestInterAParameter(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
|
||||
public String getParameterA() {
|
||||
return parameterA;
|
||||
}
|
||||
|
||||
public void setParameterA(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-consumer"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:reference id="dubboxRestInterA"
|
||||
interface="com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA"
|
||||
url="rest://127.0.0.1:20880"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE PUBLIC.sampletable1
|
||||
(
|
||||
key1 VARCHAR2(36) PRIMARY KEY,
|
||||
value1 VARCHAR2(36) NOT NULL
|
||||
);
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#\u53ca\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b\uff0c\u5927\u4e8e\u7b49\u4e8e\u8be5\u7ea7\u522b\u7684\u65e5\u5fd7\u5c06\u88ab\u8f93\u51fa\uff08 DEBUG < INFO < WARN < ERROR < FATAL \uff09 \u8bbe\u4e3aOFF\u53ef\u4ee5\u5173\u95ed\u65e5\u5fd7
|
||||
log4j.rootLogger=info, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %l %m%n
|
||||
|
||||
log4j.logger.com.hshbic.cloud.openapi.develop2=INFO
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="error">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
<Console name="Console2" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-dubbo-rest-provider"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:protocol name="rest" port="20880" server="tomcat"/>
|
||||
<bean id="dubboxRestInterA" class="com.ai.cloud.skywalking.sample.dubboxrest.impl.DubboxRestInterAImpl"/>
|
||||
<dubbo:service interface="com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA"
|
||||
ref="dubboxRestInterA"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
<!-- 自动扫描 -->
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.sample"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="H2">
|
||||
<jdbc:script location="classpath:db/sql/create-db.sql" />
|
||||
</jdbc:embedded-database>
|
||||
|
||||
<import resource="classpath*:provider/dubbox-rest-provider.xml"/>
|
||||
</beans>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,47 @@
|
|||
#skyWalking用户ID
|
||||
skywalking.user_id=123
|
||||
#skyWalking应用编码
|
||||
skywalking.application_code=skywalking-sample-dubbo
|
||||
#skywalking auth的环境变量名字
|
||||
skywalking.auth_system_env_name=SKYWALKING_RUN
|
||||
#skywalking数据编码
|
||||
skywalking.charset=UTF-8
|
||||
skywalking.auth_override=true
|
||||
#是否使用STD替换日志输出
|
||||
skywalking.logger_std_out_override=false;
|
||||
|
||||
#是否打印数据
|
||||
buriedpoint.printf=true
|
||||
#埋点异常的最大长度
|
||||
buriedpoint.max_exception_stack_length=4000
|
||||
#业务字段的最大长度
|
||||
buriedpoint.businesskey_max_length=300
|
||||
#过滤异常
|
||||
buriedpoint.exclusive_exceptions=java.lang.RuntimeException
|
||||
|
||||
#最大发送者的连接数阀比例
|
||||
sender.connect_percent=100
|
||||
#发送服务端配置
|
||||
sender.servers_addr=127.0.0.1:34000
|
||||
#最大发送的副本数量
|
||||
sender.max_copy_num=2
|
||||
#发送的最大长度
|
||||
sender.max_send_length=20000
|
||||
#当没有Sender时,尝试获取sender的等待周期
|
||||
sender.retry_get_sender_wait_interval=2000
|
||||
|
||||
#最大消费线程数
|
||||
consumer.max_consumer=1
|
||||
#消费者最大等待时间
|
||||
consumer.max_wait_time=5
|
||||
#发送失败等待时间
|
||||
consumer.consumer_fail_retry_wait_interval=50
|
||||
|
||||
#每个Buffer的最大个数
|
||||
buffer.buffer_max_size=18000
|
||||
#Buffer池的最大长度
|
||||
buffer.pool_size=5
|
||||
|
||||
#发送检查线程检查周期
|
||||
senderchecker.check_polling_time=200
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-consumer"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:reference id="dubboxRestInterA"
|
||||
interface="com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA"
|
||||
url="rest://127.0.0.1:20880"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE PUBLIC.sampletable1
|
||||
(
|
||||
key1 VARCHAR2(36) PRIMARY KEY,
|
||||
value1 VARCHAR2(36) NOT NULL
|
||||
);
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#\u53ca\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b\uff0c\u5927\u4e8e\u7b49\u4e8e\u8be5\u7ea7\u522b\u7684\u65e5\u5fd7\u5c06\u88ab\u8f93\u51fa\uff08 DEBUG < INFO < WARN < ERROR < FATAL \uff09 \u8bbe\u4e3aOFF\u53ef\u4ee5\u5173\u95ed\u65e5\u5fd7
|
||||
log4j.rootLogger=info, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %l %m%n
|
||||
|
||||
log4j.logger.com.hshbic.cloud.openapi.develop2=INFO
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="error">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
<Console name="Console2" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-dubbo-rest-provider"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:protocol name="rest" port="20880" server="tomcat"/>
|
||||
<bean id="dubboxRestInterA" class="com.ai.cloud.skywalking.sample.dubboxrest.impl.DubboxRestInterAImpl"/>
|
||||
<dubbo:service interface="com.ai.cloud.skywalking.sample.dubboxrest.interfaces.IDubboxRestInterA"
|
||||
ref="dubboxRestInterA"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
<!-- 自动扫描 -->
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.sample"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="H2">
|
||||
<jdbc:script location="classpath:db/sql/create-db.sql" />
|
||||
</jdbc:embedded-database>
|
||||
|
||||
<import resource="classpath*:provider/dubbox-rest-provider.xml"/>
|
||||
</beans>
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
<modules>
|
||||
<module>example-web</module>
|
||||
<module>example-dubbo</module>
|
||||
<module>example-dubbox-rest</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
|
|||
}
|
||||
|
||||
private String generateSubParentLevelId(Span spanData) {
|
||||
if (spanData.getParentLevel() == null) {
|
||||
if (spanData.getParentLevel() == null || spanData.getParentLevel().length() == 0) {
|
||||
return spanData.getLevelId() + "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.concurrent.Callable;
|
||||
|
||||
public class MethodInputAndOutParameterInterceptor {
|
||||
|
||||
public static IBuriedPointType METHOD_INVOKE_BURIEDPOINT = new IBuriedPointType() {
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
|
|
@ -22,8 +23,10 @@ public class MethodInputAndOutParameterInterceptor {
|
|||
return CallType.SYNC;
|
||||
}
|
||||
};
|
||||
|
||||
@RuntimeType
|
||||
public Object interceptor(@AllArguments Object[] allArgument, @Origin Method method, @Origin Class<?> clazz, @SuperCall Callable<?> zuper) throws Exception {
|
||||
public Object interceptor(@AllArguments Object[] allArgument, @Origin Method method, @Origin Class<?> clazz,
|
||||
@SuperCall Callable<?> zuper) throws Exception {
|
||||
|
||||
|
||||
|
||||
|
|
@ -31,7 +34,6 @@ public class MethodInputAndOutParameterInterceptor {
|
|||
try {
|
||||
ret = zuper.call();
|
||||
} catch (Throwable e) {
|
||||
|
||||
throw e;
|
||||
} finally {
|
||||
|
||||
|
|
|
|||
|
|
@ -30,16 +30,12 @@ public final class ContextGenerator {
|
|||
* @return
|
||||
*/
|
||||
public static Span generateSpanFromContextData(ContextData context, Identification id) {
|
||||
Span spanData;
|
||||
// 校验传入的参数是否为空,如果为空,则新创建一个
|
||||
if (context == null || StringUtil.isEmpty(context.getTraceId())) {
|
||||
// 不存在,新创建一个Context
|
||||
spanData = new Span(TraceIdGenerator.generate(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USER_ID);
|
||||
} else {
|
||||
// 如果不为空,则将当前的Context存放到上下文
|
||||
Span spanData = CurrentThreadSpanStack.peek();
|
||||
if (context != null && !StringUtil.isEmpty(context.getTraceId()) && spanData == null){
|
||||
spanData = new Span(context.getTraceId(), context.getParentLevel(), context.getLevelId(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USER_ID);
|
||||
}else{
|
||||
spanData = getSpanFromThreadLocal();
|
||||
}
|
||||
|
||||
spanData.setStartDate(System.currentTimeMillis());
|
||||
spanData.setViewPointId(id.getViewPoint());
|
||||
return spanData;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class MonitorFilterInterceptor implements InstanceMethodsAroundIntercepto
|
|||
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
Object ret) {
|
||||
Result result = (Result) ret;
|
||||
if (result.getException() != null) {
|
||||
if (result != null && result.getException() != null) {
|
||||
dealException(result.getException(), context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
this.viewPointId = spanData.getViewPointId();
|
||||
}
|
||||
|
||||
private AckSpan() {
|
||||
public AckSpan() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class RequestSpan extends AbstractDataSerializable {
|
|||
this.userId = spanData.getUserId();
|
||||
}
|
||||
|
||||
private RequestSpan() {
|
||||
public RequestSpan() {
|
||||
|
||||
}
|
||||
private boolean isEntrySpan() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue