diff --git a/pom.xml b/pom.xml index 9b7dd6318..57d6da095 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,6 @@ skywalking-storage-center skywalking-opentracing-kit - samples/skywalking-auth samples/skywalking-example pom diff --git a/samples/skywalking-auth/pom.xml b/samples/skywalking-auth/pom.xml deleted file mode 100644 index 720006e74..000000000 --- a/samples/skywalking-auth/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - com.a.eye - skywalking-auth - 2.0-2016 - jar - - skywalking-auth - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 3.8.1 - test - - - diff --git a/samples/skywalking-auth/src/main/resources/sky-walking.auth b/samples/skywalking-auth/src/main/resources/sky-walking.auth deleted file mode 100644 index 537d9b2f8..000000000 --- a/samples/skywalking-auth/src/main/resources/sky-walking.auth +++ /dev/null @@ -1,54 +0,0 @@ -#skyWalking用户ID -skywalking.user_id=18 -#skyWalking应用编码 -skywalking.application_code=meet-web -#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 - -#自定义本地方法插件是否开启 -plugin.customlocalmethodinterceptorplugin.is_enable=false -#自定义插件拦截的包前缀 -plugin.customlocalmethodinterceptorplugin.package_prefix= -#自定义插件是否记录入参 -plugin.customlocalmethodinterceptorplugin.record_param_enable=false - diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/conf/ConfigInitializer.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/conf/ConfigInitializer.java index 17e149b52..d48ecaebb 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/conf/ConfigInitializer.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/conf/ConfigInitializer.java @@ -20,13 +20,9 @@ public class ConfigInitializer { if (Config.SkyWalking.IS_PREMAIN_MODE) { configFileStream = fetchAuthFileInputStream(); } else { - configFileStream = ConfigInitializer.class.getResourceAsStream("/sky-walking.auth"); + configFileStream = ConfigInitializer.class.getResourceAsStream("/sky-walking.config"); } - Config.SkyWalking.USER_ID = System.getProperty("userId"); - Config.SkyWalking.APPLICATION_CODE = System.getProperty("applicationCode"); - Config.SkyWalking.SERVERS = System.getProperty("servers"); - if (configFileStream == null) { logger.info("Not provide sky-walking certification documents, sky-walking api run in default config."); } else { @@ -38,6 +34,9 @@ public class ConfigInitializer { logger.error("Failed to read the config file, sky-walking api run in default config.", e); } } + Config.SkyWalking.USER_ID = System.getProperty("userId"); + Config.SkyWalking.APPLICATION_CODE = System.getProperty("applicationCode"); + Config.SkyWalking.SERVERS = System.getProperty("servers"); if(StringUtil.isEmpty(Config.SkyWalking.USER_ID)){ throw new ExceptionInInitializerError("'-DuserId=' is missing."); diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java new file mode 100644 index 000000000..fcd197c79 --- /dev/null +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java @@ -0,0 +1,23 @@ +package com.a.eye.skywalking.plugin.bytebuddy; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; + +/** + * Created by wusheng on 2016/12/1. + */ +public class ArgumentTypeNameMatch implements ElementMatcher { + private int index; + + private String argumentTypeName; + + public ArgumentTypeNameMatch(int index, String argumentTypeName) { + this.index = index; + this.argumentTypeName = argumentTypeName; + } + + @Override + public boolean matches(MethodDescription target) { + return target.getParameters().get(index).getType().asErasure().getName().equals(argumentTypeName); + } +} diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java index 52a9f235e..b1d4b2398 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/interceptor/ConstructorInterceptPoint.java @@ -7,7 +7,7 @@ import net.bytebuddy.matcher.ElementMatcher; * Created by wusheng on 2016/11/29. */ public interface ConstructorInterceptPoint{ - ElementMatcher.Junction getConstructorMatcher(); + ElementMatcher getConstructorMatcher(); /** * diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java index 2d791ee9e..97558beb5 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisClusterPluginDefine.java @@ -1,5 +1,6 @@ package com.a.eye.skywalking.plugin.jedis.v2.define; +import com.a.eye.skywalking.plugin.bytebuddy.ArgumentTypeNameMatch; import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; @@ -24,7 +25,7 @@ public class JedisClusterPluginDefine extends ClassInstanceMethodsEnhancePluginD protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { + public ElementMatcher getConstructorMatcher() { return takesArgument(0, Set.class); } @@ -34,8 +35,8 @@ public class JedisClusterPluginDefine extends ClassInstanceMethodsEnhancePluginD } }, new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { - return not(takesArgument(0, Set.class)); + public ElementMatcher getConstructorMatcher() { + return new ArgumentTypeNameMatch(0, "redis.clients.jedis.HostAndPort"); } @Override diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java index e0e402bce..9d262f002 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java @@ -1,5 +1,6 @@ package com.a.eye.skywalking.plugin.jedis.v2.define; +import com.a.eye.skywalking.plugin.bytebuddy.ArgumentTypeNameMatch; import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint; import com.a.eye.skywalking.plugin.interceptor.MethodMatcher; @@ -24,7 +25,7 @@ public class JedisPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { + public ElementMatcher getConstructorMatcher() { return takesArgument(0, String.class); } @@ -34,8 +35,8 @@ public class JedisPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { } }, new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { - return not(takesArgument(0, String.class).or(takesArgument(0, String.class))); + public ElementMatcher getConstructorMatcher() { + return new ArgumentTypeNameMatch(0, "redis.clients.jedis.HostAndPort"); } @Override @@ -44,7 +45,7 @@ public class JedisPluginDefine extends ClassInstanceMethodsEnhancePluginDefine { } }, new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { + public ElementMatcher getConstructorMatcher() { return takesArgument(0, String.class); } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java index c0fef90c7..235b58d01 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanClientDefine.java @@ -20,7 +20,7 @@ public class MotanClientDefine extends ClassInstanceMethodsEnhancePluginDefine { protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { + public ElementMatcher getConstructorMatcher() { return any(); } diff --git a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java index f998934ea..91b847005 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/define/MotanServerDefine.java @@ -21,7 +21,7 @@ public class MotanServerDefine extends ClassInstanceMethodsEnhancePluginDefine { protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return new ConstructorInterceptPoint[] {new ConstructorInterceptPoint() { @Override - public ElementMatcher.Junction getConstructorMatcher() { + public ElementMatcher getConstructorMatcher() { return any(); }