1. 提交测试类
This commit is contained in:
parent
3a31c5bb6a
commit
f12701514a
|
|
@ -4,9 +4,7 @@ import com.ai.cloud.skywalking.jedis.v2.plugin.JedisClusterInterceptor;
|
|||
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.matcher.AnyMethodMatcher;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.matcher.MethodsExclusiveMatcher;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.matcher.AnyMethodsMatcher;
|
||||
|
||||
public class JedisClusterPluginDefine implements InterceptorDefine {
|
||||
|
||||
|
|
@ -18,7 +16,7 @@ public class JedisClusterPluginDefine implements InterceptorDefine {
|
|||
@Override
|
||||
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
|
||||
return new MethodMatcher[]{
|
||||
new SimpleMethodMatcher("set")
|
||||
new AnyMethodsMatcher()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ public class JedisPluginDefine implements InterceptorDefine {
|
|||
new SimpleMethodMatcher("connect"),
|
||||
new SimpleMethodMatcher("setDataSource"),
|
||||
new SimpleMethodMatcher("resetState"),
|
||||
new SimpleMethodMatcher("clusterSlots")
|
||||
new SimpleMethodMatcher("clusterSlots"),
|
||||
new SimpleMethodMatcher("checkIsInMultiOrPipeline")
|
||||
)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ai.cloud.skywalking.jedis.v2.plugin;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.TracingBootstrap;
|
||||
import com.ai.skywalking.testframework.api.TraceTreeAssert;
|
||||
import org.junit.Test;
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
|
|
@ -21,17 +22,14 @@ public class JedisClusterTest {
|
|||
|
||||
public static void main(String[] args) throws ClassNotFoundException,
|
||||
SQLException, InterruptedException {
|
||||
JedisCluster jedisCluster = null;
|
||||
try {
|
||||
jedisCluster = new JedisCluster(getHostAndPorts());
|
||||
long start = System.currentTimeMillis();
|
||||
jedisCluster.set("11111", "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println(end - start + "ms");
|
||||
jedisCluster.del("11111");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JedisCluster jedisCluster = new JedisCluster(getHostAndPorts());
|
||||
jedisCluster.set("11111", "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
TraceTreeAssert.assertEquals(new String[][]{
|
||||
// 根据实际情况进行修改
|
||||
{"0.0", "127.0.0.1:7001 set", "key=11111"},
|
||||
{"0", "127.0.0.1:7002;127.0.0.1:7001;127.0.0.1:7000;127.0.0.1:7005;127.0.0.1:7004;127.0.0.1:7003; set", "key=11111"},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static Set<HostAndPort> getHostAndPorts() {
|
||||
|
|
@ -44,8 +42,4 @@ public class JedisClusterTest {
|
|||
redisEnv.add(new HostAndPort("127.0.0.1", 7005));
|
||||
return redisEnv;
|
||||
}
|
||||
|
||||
public void testNormal() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, InterruptedException {
|
||||
JedisClusterTest.main(null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ai.cloud.skywalking.jedis.v2.plugin;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.ai.skywalking.testframework.api.TraceTreeAssert;
|
||||
import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
|
@ -22,16 +23,12 @@ public class JedisTest {
|
|||
SQLException, InterruptedException {
|
||||
Jedis jedis = null;
|
||||
try{
|
||||
jedis = new Jedis("10.1.241.18", 16379);
|
||||
long start = System.currentTimeMillis();
|
||||
jedis = new Jedis("127.0.0.1", 6379);
|
||||
jedis.set("11111", "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
for (int i = 0; i < 1; i++) {
|
||||
jedis.get("11111");
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println(end - start + "ms");
|
||||
jedis.del("11111");
|
||||
}catch(Exception e){
|
||||
TraceTreeAssert.assertEquals(new String[][]{
|
||||
{"0", "127.0.0.1:6379 set", "key=11111"},
|
||||
});
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
jedis.close();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ skywalking.application_code=test
|
|||
skywalking.auth_system_env_name=SKYWALKING_RUN
|
||||
#skywalking数据编码
|
||||
skywalking.charset=UTF-8
|
||||
|
||||
skywalking.auth_override=true
|
||||
#是否打印数据
|
||||
buriedpoint.printf=true
|
||||
#埋点异常的最大长度
|
||||
|
|
@ -27,11 +27,8 @@ sender.max_send_length=20000
|
|||
#当没有Sender时,尝试获取sender的等待周期
|
||||
sender.retry_get_sender_wait_interval=2000
|
||||
|
||||
|
||||
|
||||
|
||||
#最大消费线程数
|
||||
consumer.max_consumer=2
|
||||
consumer.max_consumer=0
|
||||
#消费者最大等待时间
|
||||
consumer.max_wait_time=5
|
||||
#发送失败等待时间
|
||||
|
|
|
|||
Loading…
Reference in New Issue