Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
738d1564
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
738d1564
编写于
3月 13, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Recover logging-api/logging-log4j2 modules. Adjust codes for new modules.
上级
2fb18ebc
变更
82
隐藏空白更改
内联
并排
Showing
82 changed file
with
561 addition
and
254 deletion
+561
-254
skywalking-collector/pom.xml
skywalking-collector/pom.xml
+1
-32
skywalking-collector/skywalking-collector-cluster/pom.xml
skywalking-collector/skywalking-collector-cluster/pom.xml
+4
-9
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractMember.java
.../com/a/eye/skywalking/collector/actor/AbstractMember.java
+3
-4
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractWorker.java
.../com/a/eye/skywalking/collector/actor/AbstractWorker.java
+3
-4
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractWorkerProvider.java
...ye/skywalking/collector/actor/AbstractWorkerProvider.java
+3
-4
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/WorkerRef.java
.../java/com/a/eye/skywalking/collector/actor/WorkerRef.java
+3
-3
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/WorkersCreator.java
.../com/a/eye/skywalking/collector/actor/WorkersCreator.java
+3
-3
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/cluster/ClusterConfigInitializer.java
...kywalking/collector/cluster/ClusterConfigInitializer.java
+3
-4
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/cluster/WorkersListener.java
...m/a/eye/skywalking/collector/cluster/WorkersListener.java
+3
-3
skywalking-collector/skywalking-collector-worker/pom.xml
skywalking-collector/skywalking-collector-worker/pom.xml
+11
-1
skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/CollectorBootStartUp.java
...eye/skywalking/collector/worker/CollectorBootStartUp.java
+4
-0
skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/JsonSerializer.java
...com/a/eye/skywalking/collector/worker/JsonSerializer.java
+0
-5
skywalking-commons/pom.xml
skywalking-commons/pom.xml
+2
-0
skywalking-commons/skywalking-logging-api/pom.xml
skywalking-commons/skywalking-logging-api/pom.xml
+15
-0
skywalking-commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/ILog.java
...-api/src/main/java/com/a/eye/skywalking/logging/ILog.java
+1
-1
skywalking-commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/LogManager.java
...rc/main/java/com/a/eye/skywalking/logging/LogManager.java
+1
-1
skywalking-commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/LogResolver.java
...c/main/java/com/a/eye/skywalking/logging/LogResolver.java
+1
-1
skywalking-commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/NoopLogger.java
...rc/main/java/com/a/eye/skywalking/logging/NoopLogger.java
+1
-1
skywalking-commons/skywalking-logging-api/src/test/java/com/a/eye/skywalking/logging/LogManagerTest.java
...est/java/com/a/eye/skywalking/logging/LogManagerTest.java
+3
-15
skywalking-commons/skywalking-logging-api/src/test/java/com/a/eye/skywalking/logging/NoopLoggerTest.java
...est/java/com/a/eye/skywalking/logging/NoopLoggerTest.java
+2
-3
skywalking-commons/skywalking-logging-log4j2/pom.xml
skywalking-commons/skywalking-logging-log4j2/pom.xml
+31
-0
skywalking-commons/skywalking-logging-log4j2/src/main/java/com/a/eye/skywalking/logging/log4j2/Log4j2Logger.java
...ava/com/a/eye/skywalking/logging/log4j2/Log4j2Logger.java
+76
-0
skywalking-commons/skywalking-logging-log4j2/src/main/java/com/a/eye/skywalking/logging/log4j2/Log4j2Resolver.java
...a/com/a/eye/skywalking/logging/log4j2/Log4j2Resolver.java
+17
-0
skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
...lking-sniffer/skywalking-agent/dependency-reduced-pom.xml
+40
-4
skywalking-sniffer/skywalking-agent/pom.xml
skywalking-sniffer/skywalking-agent/pom.xml
+37
-2
skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java
...main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java
+5
-2
skywalking-sniffer/skywalking-api/pom.xml
skywalking-sniffer/skywalking-api/pom.xml
+14
-4
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/BootService.java
.../main/java/com/a/eye/skywalking/api/boot/BootService.java
+12
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java
...in/java/com/a/eye/skywalking/api/boot/ServiceStarter.java
+41
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/StatusBootService.java
...java/com/a/eye/skywalking/api/boot/StatusBootService.java
+32
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/SnifferConfigInitializer.java
...m/a/eye/skywalking/api/conf/SnifferConfigInitializer.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/context/ContextManager.java
...java/com/a/eye/skywalking/api/context/ContextManager.java
+24
-24
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/logging/EasyLogResolver.java
...ava/com/a/eye/skywalking/api/logging/EasyLogResolver.java
+3
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/logging/EasyLogger.java
...ain/java/com/a/eye/skywalking/api/logging/EasyLogger.java
+1
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/AbstractClassEnhancePluginDefine.java
...ywalking/api/plugin/AbstractClassEnhancePluginDefine.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/PluginBootstrap.java
...java/com/a/eye/skywalking/api/plugin/PluginBootstrap.java
+3
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/PluginResourcesResolver.java
.../a/eye/skywalking/api/plugin/PluginResourcesResolver.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/TracingBootstrap.java
...ava/com/a/eye/skywalking/api/plugin/TracingBootstrap.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassConstructorInterceptor.java
...ugin/interceptor/enhance/ClassConstructorInterceptor.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassEnhancePluginDefine.java
.../plugin/interceptor/enhance/ClassEnhancePluginDefine.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassInstanceMethodsInterceptor.java
.../interceptor/enhance/ClassInstanceMethodsInterceptor.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassStaticMethodsInterceptor.java
...in/interceptor/enhance/ClassStaticMethodsInterceptor.java
+2
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/DefaultClassConstructorInterceptor.java
...terceptor/enhance/DefaultClassConstructorInterceptor.java
+3
-2
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/loader/InterceptorInstanceLoader.java
.../plugin/interceptor/loader/InterceptorInstanceLoader.java
+2
-3
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java
.../a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java
+18
-16
skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService
...TA-INF/services/com.a.eye.skywalking.api.boot.BootService
+2
-0
skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api/context/ContextManagerTestCase.java
.../a/eye/skywalking/api/context/ContextManagerTestCase.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptor.java
...a/com/a/eye/skywalking/plugin/dubbo/DubboInterceptor.java
+5
-5
skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java
...m/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/pom.xml
...iffer/skywalking-sdk-plugin/httpClient-4.x-plugin/pom.xml
+1
-1
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptor.java
...ng/plugin/httpClient/v4/HttpClientExecuteInterceptor.java
+7
-7
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java
...lugin/httpClient/v4/HttpClientExecuteInterceptorTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/CallableStatementTracing.java
.../eye/skywalking/plugin/jdbc/CallableStatementTracing.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
...a/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
.../eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
...va/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java
...a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java
+3
-1
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java
...ava/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java
...a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java
...ye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java
+3
-3
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java
...kywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptor.java
...eye/skywalking/plugin/motan/MotanConsumerInterceptor.java
+5
-5
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/MotanProviderInterceptor.java
...eye/skywalking/plugin/motan/MotanProviderInterceptor.java
+5
-5
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java
...skywalking/plugin/motan/MotanConsumerInterceptorTest.java
+4
-1
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptor.java
.../a/eye/skywalking/plugin/tomcat78x/TomcatInterceptor.java
+5
-5
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java
...ye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java
+5
-1
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/DubboSpanGenerator.java
.../sniffer/mock/trace/builders/span/DubboSpanGenerator.java
+4
-4
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/MySQLGenerator.java
...king/sniffer/mock/trace/builders/span/MySQLGenerator.java
+2
-2
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/TomcatSpanGenerator.java
...sniffer/mock/trace/builders/span/TomcatSpanGenerator.java
+9
-9
skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java
...lking/sniffer/mock/MockTracerContextListenerTestCase.java
+7
-0
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/log4j/v1/x/PrintTraceIdInterceptor.java
...it/activation/log/log4j/v1/x/PrintTraceIdInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/log4j/v2/x/PrintTraceIdInterceptor.java
...it/activation/log/log4j/v2/x/PrintTraceIdInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-logback-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/logback/v1/x/PrintTraceIdInterceptor.java
.../activation/log/logback/v1/x/PrintTraceIdInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/pom.xml
...ivation/skywalking-toolkit-opentracing-activation/pom.xml
+1
-0
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanFinishInterceptor.java
...n/opentracing/span/interceptor/SpanFinishInterceptor.java
+2
-2
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanNewInstanceInterceptor.java
...ntracing/span/interceptor/SpanNewInstanceInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanSetOperationNameInterceptor.java
...ing/span/interceptor/SpanSetOperationNameInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanSetTagInterceptor.java
...n/opentracing/span/interceptor/SpanSetTagInterceptor.java
+3
-3
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerExtractCrossProcessByteBufferContextInterceptor.java
...racerExtractCrossProcessByteBufferContextInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerExtractCrossProcessTextMapContextInterceptor.java
...r/TracerExtractCrossProcessTextMapContextInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerFormatCrossProcessContextInterceptor.java
...terceptor/TracerFormatCrossProcessContextInterceptor.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-trace-context-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/trace/TraceContextInterceptor.java
...ing/toolkit/activation/trace/TraceContextInterceptor.java
+3
-3
未找到文件。
skywalking-collector/pom.xml
浏览文件 @
738d1564
...
...
@@ -24,36 +24,6 @@
<artifactId>
akka-cluster_2.11
</artifactId>
<version>
${akka.version}
</version>
</dependency>
<dependency>
<groupId>
com.typesafe.akka
</groupId>
<artifactId>
akka-cluster-metrics_2.11
</artifactId>
<version>
${akka.version}
</version>
</dependency>
<dependency>
<groupId>
com.typesafe.akka
</groupId>
<artifactId>
akka-cluster-tools_2.11
</artifactId>
<version>
${akka.version}
</version>
</dependency>
<dependency>
<groupId>
com.typesafe.akka
</groupId>
<artifactId>
akka-persistence_2.11
</artifactId>
<version>
${akka.version}
</version>
</dependency>
<dependency>
<groupId>
org.iq80.leveldb
</groupId>
<artifactId>
leveldb
</artifactId>
<version>
0.9
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.8
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
<version>
2.8
</version>
</dependency>
<dependency>
<groupId>
com.typesafe.akka
</groupId>
<artifactId>
akka-testkit_2.11
</artifactId>
...
...
@@ -62,9 +32,8 @@
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-
sniffer-mock
</artifactId>
<artifactId>
skywalking-
logging-api
</artifactId>
<version>
${project.version}
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
skywalking-collector/skywalking-collector-cluster/pom.xml
浏览文件 @
738d1564
...
...
@@ -17,19 +17,14 @@
<dependencies>
<dependency>
<groupId>
javax.inject
</groupId>
<artifactId>
javax.inject
</artifactId>
<version>
1
</version>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-util
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.lmax
</groupId>
<artifactId>
disruptor
</artifactId>
<version>
3.3.6
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-api
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractMember.java
浏览文件 @
738d1564
...
...
@@ -4,10 +4,9 @@ import akka.actor.ActorRef;
import
com.a.eye.skywalking.collector.actor.selector.WorkerSelector
;
import
com.a.eye.skywalking.collector.cluster.WorkersRefCenter
;
import
com.a.eye.skywalking.collector.queue.MessageHolder
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.lmax.disruptor.EventHandler
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.List
;
/**
...
...
@@ -15,7 +14,7 @@ import java.util.List;
*/
public
abstract
class
AbstractMember
implements
EventHandler
<
MessageHolder
>
{
private
Logger
logger
=
LogManager
.
getFormatter
Logger
(
AbstractMember
.
class
);
private
ILog
logger
=
LogManager
.
get
Logger
(
AbstractMember
.
class
);
private
ActorRef
actorRef
;
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractWorker.java
浏览文件 @
738d1564
...
...
@@ -9,9 +9,8 @@ import com.a.eye.skywalking.collector.actor.selector.WorkerSelector;
import
com.a.eye.skywalking.collector.cluster.WorkerListenerMessage
;
import
com.a.eye.skywalking.collector.cluster.WorkersListener
;
import
com.a.eye.skywalking.collector.cluster.WorkersRefCenter
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.util.List
;
/**
...
...
@@ -40,7 +39,7 @@ import java.util.List;
*/
public
abstract
class
AbstractWorker
extends
UntypedActor
{
private
Logger
logger
=
LogManager
.
getFormatter
Logger
(
AbstractWorker
.
class
);
private
ILog
logger
=
LogManager
.
get
Logger
(
AbstractWorker
.
class
);
private
Cluster
cluster
=
Cluster
.
get
(
getContext
().
system
());
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/AbstractWorkerProvider.java
浏览文件 @
738d1564
...
...
@@ -2,8 +2,8 @@ package com.a.eye.skywalking.collector.actor;
import
akka.actor.ActorSystem
;
import
akka.actor.Props
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Log
ger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogMana
ger
;
/**
* The <code>AbstractWorkerProvider</code> should be implemented by any class whose
...
...
@@ -28,8 +28,7 @@ import org.apache.logging.log4j.Logger;
* <p>
*/
public
abstract
class
AbstractWorkerProvider
{
private
Logger
logger
=
LogManager
.
getFormatterLogger
(
AbstractWorkerProvider
.
class
);
private
ILog
logger
=
LogManager
.
getLogger
(
AbstractWorkerProvider
.
class
);
public
abstract
Class
workerClass
();
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/WorkerRef.java
浏览文件 @
738d1564
...
...
@@ -2,8 +2,8 @@ package com.a.eye.skywalking.collector.actor;
import
akka.actor.ActorPath
;
import
akka.actor.ActorRef
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Log
ger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogMana
ger
;
/**
* The Worker reference
...
...
@@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger;
* @author pengys5
*/
public
class
WorkerRef
{
private
Logger
logger
=
LogManager
.
getFormatter
Logger
(
WorkerRef
.
class
);
private
ILog
logger
=
LogManager
.
get
Logger
(
WorkerRef
.
class
);
final
ActorRef
actorRef
;
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/actor/WorkersCreator.java
浏览文件 @
738d1564
...
...
@@ -3,8 +3,8 @@ package com.a.eye.skywalking.collector.actor;
import
akka.actor.ActorSystem
;
import
akka.actor.Props
;
import
com.a.eye.skywalking.collector.cluster.WorkersListener
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Log
ger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogMana
ger
;
import
java.util.ServiceLoader
;
...
...
@@ -17,7 +17,7 @@ import java.util.ServiceLoader;
public
enum
WorkersCreator
{
INSTANCE
;
private
Logger
logger
=
LogManager
.
getFormatter
Logger
(
WorkersCreator
.
class
);
private
ILog
logger
=
LogManager
.
get
Logger
(
WorkersCreator
.
class
);
/**
* create worker to use Java Spi.
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/cluster/ClusterConfigInitializer.java
浏览文件 @
738d1564
...
...
@@ -2,9 +2,8 @@ package com.a.eye.skywalking.collector.cluster;
import
com.a.eye.skywalking.api.util.ConfigInitializer
;
import
com.a.eye.skywalking.api.util.StringUtil
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.io.InputStream
;
import
java.util.Properties
;
...
...
@@ -21,7 +20,7 @@ import java.util.Properties;
*/
public
class
ClusterConfigInitializer
{
private
static
Logger
logger
=
LogManager
.
getFormatter
Logger
(
ClusterConfigInitializer
.
class
);
private
static
ILog
logger
=
LogManager
.
get
Logger
(
ClusterConfigInitializer
.
class
);
public
static
final
String
ConfigFileName
=
"collector.config"
;
...
...
skywalking-collector/skywalking-collector-cluster/src/main/java/com/a/eye/skywalking/collector/cluster/WorkersListener.java
浏览文件 @
738d1564
...
...
@@ -5,8 +5,8 @@ import akka.actor.Terminated;
import
akka.actor.UntypedActor
;
import
akka.cluster.Cluster
;
import
akka.cluster.ClusterEvent
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Log
ger
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogMana
ger
;
/**
* <code>WorkersListener</code> listening the register message from workers
...
...
@@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger;
*/
public
class
WorkersListener
extends
UntypedActor
{
private
Logger
logger
=
LogManager
.
getFormatter
Logger
(
WorkersListener
.
class
);
private
ILog
logger
=
LogManager
.
get
Logger
(
WorkersListener
.
class
);
public
static
final
String
WorkName
=
"WorkersListener"
;
...
...
skywalking-collector/skywalking-collector-worker/pom.xml
浏览文件 @
738d1564
...
...
@@ -18,6 +18,16 @@
<artifactId>
skywalking-collector-cluster
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-trace
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-logging-log4j2
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
...
...
@@ -35,4 +45,4 @@
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/CollectorBootStartUp.java
浏览文件 @
738d1564
...
...
@@ -6,6 +6,8 @@ import com.a.eye.skywalking.collector.cluster.ClusterConfig;
import
com.a.eye.skywalking.collector.cluster.ClusterConfigInitializer
;
import
com.a.eye.skywalking.collector.cluster.NoAvailableWorkerException
;
import
com.a.eye.skywalking.collector.worker.storage.EsClient
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.logging.log4j2.Log4j2Resolver
;
import
com.typesafe.config.Config
;
import
com.typesafe.config.ConfigFactory
;
...
...
@@ -17,6 +19,8 @@ import java.net.UnknownHostException;
public
class
CollectorBootStartUp
{
public
static
void
main
(
String
[]
args
)
throws
NoAvailableWorkerException
,
InterruptedException
,
UnknownHostException
{
LogManager
.
setLogResolver
(
new
Log4j2Resolver
());
ClusterConfigInitializer
.
initialize
(
"collector.config"
);
final
Config
config
=
ConfigFactory
.
parseString
(
"akka.remote.netty.tcp.hostname="
+
ClusterConfig
.
Cluster
.
Current
.
hostname
).
...
...
skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/JsonSerializer.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.collector.worker
;
import
akka.serialization.JSerializer
;
import
com.a.eye.skywalking.trace.TraceSegment
;
import
com.a.eye.skywalking.trace.proto.SegmentMessage
;
import
com.google.gson.Gson
;
import
com.google.gson.JsonObject
;
import
com.google.protobuf.InvalidProtocolBufferException
;
/**
* @author pengys5
...
...
@@ -23,14 +20,12 @@ public class JsonSerializer extends JSerializer {
@Override
public
byte
[]
toBinary
(
Object
o
)
{
// System.out.println("Json toBinary");
JsonObject
jsonObject
=
(
JsonObject
)
o
;
return
jsonObject
.
toString
().
getBytes
();
}
@Override
public
Object
fromBinaryJava
(
byte
[]
bytes
,
Class
<?>
manifest
)
{
// System.out.println("Json fromBinaryJava");
Gson
gson
=
new
Gson
();
return
gson
.
fromJson
(
new
String
(
bytes
),
JsonObject
.
class
);
}
...
...
skywalking-commons/pom.xml
浏览文件 @
738d1564
...
...
@@ -13,6 +13,8 @@
<modules>
<module>
skywalking-trace
</module>
<module>
skywalking-util
</module>
<module>
skywalking-logging-api
</module>
<module>
skywalking-logging-log4j2
</module>
</modules>
<name>
skywalking-commons
</name>
...
...
skywalking-commons/skywalking-logging-api/pom.xml
0 → 100644
浏览文件 @
738d1564
<?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-commons
</artifactId>
<groupId>
com.a.eye
</groupId>
<version>
3.0-2017
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
skywalking-logging-api
</artifactId>
</project>
skywalking-
sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api
/logging/ILog.java
→
skywalking-
commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking
/logging/ILog.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.
api.
logging
;
package
com.a.eye.skywalking.logging
;
/**
* The Log interface.
...
...
skywalking-
sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api
/logging/LogManager.java
→
skywalking-
commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking
/logging/LogManager.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.
api.
logging
;
package
com.a.eye.skywalking.logging
;
/**
* LogManager is the {@link LogResolver} implementation manager.
...
...
skywalking-
sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api
/logging/LogResolver.java
→
skywalking-
commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking
/logging/LogResolver.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.
api.
logging
;
package
com.a.eye.skywalking.logging
;
/**
* {@link LogResolver} just do only one thing: return the {@link ILog} implementation.
...
...
skywalking-
sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api
/logging/NoopLogger.java
→
skywalking-
commons/skywalking-logging-api/src/main/java/com/a/eye/skywalking
/logging/NoopLogger.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.
api.
logging
;
package
com.a.eye.skywalking.logging
;
/**
...
...
skywalking-
sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api
/logging/LogManagerTest.java
→
skywalking-
commons/skywalking-logging-api/src/test/java/com/a/eye/skywalking
/logging/LogManagerTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.
api.
logging
;
package
com.a.eye.skywalking.logging
;
import
org.junit.After
;
import
org.junit.Assert
;
...
...
@@ -7,21 +7,9 @@ import org.junit.Test;
import
org.powermock.api.support.membermodification.MemberModifier
;
/**
*
Created by wusheng on 2017/2/27.
*
@author wusheng
*/
public
class
LogManagerTest
{
@Test
public
void
testGetLogger
()
{
final
TestLogger
logger
=
new
TestLogger
();
LogManager
.
setLogResolver
(
new
LogResolver
()
{
@Override
public
ILog
getLogger
(
Class
<?>
clazz
)
{
return
logger
;
}
});
Assert
.
assertEquals
(
logger
,
LogManager
.
getLogger
(
LogManagerTest
.
class
));
}
@Test
public
void
testGetNoopLogger
(){
...
...
@@ -86,5 +74,5 @@ public class LogManagerTest {
}
}
}
}
skywalking-
sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api
/logging/NoopLoggerTest.java
→
skywalking-
commons/skywalking-logging-api/src/test/java/com/a/eye/skywalking
/logging/NoopLoggerTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.logging
;
package
com.a.eye.skywalking.logging
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
static
com
.
a
.
eye
.
skywalking
.
api
.
logging
.
NoopLogger
.
INSTANCE
;
import
static
com
.
a
.
eye
.
skywalking
.
logging
.
NoopLogger
.
INSTANCE
;
/**
* Created by wusheng on 2017/2/27.
...
...
skywalking-commons/skywalking-logging-log4j2/pom.xml
0 → 100644
浏览文件 @
738d1564
<?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-commons
</artifactId>
<groupId>
com.a.eye
</groupId>
<version>
3.0-2017
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
skywalking-logging-log4j2
</artifactId>
<dependencies>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-logging-api
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.8
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
<version>
2.8
</version>
</dependency>
</dependencies>
</project>
skywalking-commons/skywalking-logging-log4j2/src/main/java/com/a/eye/skywalking/logging/log4j2/Log4j2Logger.java
0 → 100644
浏览文件 @
738d1564
package
com.a.eye.skywalking.logging.log4j2
;
import
com.a.eye.skywalking.logging.ILog
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
/**
* @author wusheng
*/
public
class
Log4j2Logger
implements
ILog
{
private
Logger
delegateLogger
;
Log4j2Logger
(
Class
<?>
targetClass
){
delegateLogger
=
LogManager
.
getFormatterLogger
(
targetClass
);
}
@Override
public
void
info
(
String
format
)
{
delegateLogger
.
info
(
format
);
}
@Override
public
void
info
(
String
format
,
Object
...
arguments
)
{
delegateLogger
.
info
(
format
,
arguments
);
}
@Override
public
void
warn
(
String
format
,
Object
...
arguments
)
{
delegateLogger
.
warn
(
format
,
arguments
);
}
@Override
public
void
error
(
String
format
,
Throwable
e
)
{
delegateLogger
.
error
(
format
,
e
);
}
@Override
public
void
error
(
Throwable
e
,
String
format
,
Object
...
arguments
)
{
delegateLogger
.
error
(
format
,
e
,
arguments
);
}
@Override
public
boolean
isDebugEnable
()
{
return
delegateLogger
.
isDebugEnabled
();
}
@Override
public
boolean
isInfoEnable
()
{
return
delegateLogger
.
isInfoEnabled
();
}
@Override
public
boolean
isWarnEnable
()
{
return
delegateLogger
.
isWarnEnabled
();
}
@Override
public
boolean
isErrorEnable
()
{
return
delegateLogger
.
isErrorEnabled
();
}
@Override
public
void
debug
(
String
format
)
{
delegateLogger
.
debug
(
format
);
}
@Override
public
void
debug
(
String
format
,
Object
...
arguments
)
{
delegateLogger
.
debug
(
format
,
arguments
);
}
@Override
public
void
error
(
String
format
)
{
delegateLogger
.
error
(
format
);
}
}
skywalking-commons/skywalking-logging-log4j2/src/main/java/com/a/eye/skywalking/logging/log4j2/Log4j2Resolver.java
0 → 100644
浏览文件 @
738d1564
package
com.a.eye.skywalking.logging.log4j2
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogResolver
;
/**
* The <code>LogResolver</code> is an implementation of {@link LogResolver},
*
*
* @author wusheng
*/
public
class
Log4j2Resolver
implements
LogResolver
{
@Override
public
ILog
getLogger
(
Class
<?>
clazz
)
{
return
new
Log4j2Logger
(
clazz
);
}
}
skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
浏览文件 @
738d1564
...
...
@@ -45,6 +45,30 @@
<pattern>
${shade.com.lmax.disruptor.source}
</pattern>
<shadedPattern>
${shade.com.lmax.disruptor.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.akka.source}
</pattern>
<shadedPattern>
${shade.akka.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.com.google.source}
</pattern>
<shadedPattern>
${shade.com.google.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.all.org.source}
</pattern>
<shadedPattern>
${shade.all.org.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.scala.source}
</pattern>
<shadedPattern>
${shade.scala.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.io.aeron.source}
</pattern>
<shadedPattern>
${shade.io.aeron.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.com.typesafe.source}
</pattern>
<shadedPattern>
${shade.com.typesafe.target}
</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
...
...
@@ -112,13 +136,25 @@
</repository>
</distributionManagement>
<properties>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
<shade.package>
com.a.eye.skywalking.api.dependencies
</shade.package>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<shade.com.lmax.disruptor.source>
com.lmax.disruptor
</shade.com.lmax.disruptor.source>
<shade.com.typesafe.target>
${shade.package}.${shade.com.typesafe.source}
</shade.com.typesafe.target>
<shade.com.lmax.disruptor.target>
${shade.package}.${shade.com.lmax.disruptor.source}
</shade.com.lmax.disruptor.target>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.akka.target>
${shade.package}.${shade.akka.source}
</shade.akka.target>
<shade.io.aeron.target>
${shade.package}.${shade.io.aeron.source}
</shade.io.aeron.target>
<shade.all.org.target>
${shade.package}.${shade.all.org.source}
</shade.all.org.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<shade.scala.source>
scala
</shade.scala.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
<shade.package>
com.a.eye.skywalking.dependencies
</shade.package>
<shade.com.google.source>
com.google
</shade.com.google.source>
<shade.scala.target>
${shade.package}.${shade.scala.source}
</shade.scala.target>
<shade.com.typesafe.source>
com.typesafe
</shade.com.typesafe.source>
<shade.com.lmax.disruptor.source>
com.lmax.disruptor
</shade.com.lmax.disruptor.source>
<shade.akka.source>
akka
</shade.akka.source>
<premain.class>
com.a.eye.skywalking.agent.SkyWalkingAgent
</premain.class>
<shade.io.aeron.source>
io.aeron
</shade.io.aeron.source>
<shade.all.org.source>
org
</shade.all.org.source>
<shade.com.google.target>
${shade.package}.${shade.com.google.source}
</shade.com.google.target>
</properties>
</project>
skywalking-sniffer/skywalking-agent/pom.xml
浏览文件 @
738d1564
...
...
@@ -16,13 +16,24 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<shade.package>
com.a.eye.skywalking.
api.
dependencies
</shade.package>
<shade.package>
com.a.eye.skywalking.dependencies
</shade.package>
<premain.class>
com.a.eye.skywalking.agent.SkyWalkingAgent
</premain.class>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
<!-- queue -->
<shade.com.lmax.disruptor.source>
com.lmax.disruptor
</shade.com.lmax.disruptor.source>
<shade.com.lmax.disruptor.target>
${shade.package}.${shade.com.lmax.disruptor.source}
</shade.com.lmax.disruptor.target>
<shade.akka.source>
akka
</shade.akka.source>
<shade.akka.target>
${shade.package}.${shade.akka.source}
</shade.akka.target>
<shade.scala.source>
scala
</shade.scala.source>
<shade.scala.target>
${shade.package}.${shade.scala.source}
</shade.scala.target>
<shade.all.org.source>
org
</shade.all.org.source>
<shade.all.org.target>
${shade.package}.${shade.all.org.source}
</shade.all.org.target>
<shade.com.google.source>
com.google
</shade.com.google.source>
<shade.com.google.target>
${shade.package}.${shade.com.google.source}
</shade.com.google.target>
<shade.io.aeron.source>
io.aeron
</shade.io.aeron.source>
<shade.io.aeron.target>
${shade.package}.${shade.io.aeron.source}
</shade.io.aeron.target>
<shade.com.typesafe.source>
com.typesafe
</shade.com.typesafe.source>
<shade.com.typesafe.target>
${shade.package}.${shade.com.typesafe.source}
</shade.com.typesafe.target>
</properties>
<dependencies>
...
...
@@ -127,6 +138,30 @@
<pattern>
${shade.com.lmax.disruptor.source}
</pattern>
<shadedPattern>
${shade.com.lmax.disruptor.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.akka.source}
</pattern>
<shadedPattern>
${shade.akka.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.com.google.source}
</pattern>
<shadedPattern>
${shade.com.google.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.all.org.source}
</pattern>
<shadedPattern>
${shade.all.org.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.scala.source}
</pattern>
<shadedPattern>
${shade.scala.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.io.aeron.source}
</pattern>
<shadedPattern>
${shade.io.aeron.target}
</shadedPattern>
</relocation>
<relocation>
<pattern>
${shade.com.typesafe.source}
</pattern>
<shadedPattern>
${shade.com.typesafe.target}
</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
...
...
skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.agent
;
import
com.a.eye.skywalking.agent.junction.SkyWalkingEnhanceMatcher
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.conf.Config
;
import
com.a.eye.skywalking.api.conf.SnifferConfigInitializer
;
import
com.a.eye.skywalking.api.logging.EasyLogResolver
;
import
com.a.eye.skywalking.api.logging.ILog
;
import
com.a.eye.skywalking.api.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.AbstractClassEnhancePluginDefine
;
import
com.a.eye.skywalking.api.plugin.PluginBootstrap
;
import
com.a.eye.skywalking.api.plugin.PluginFinder
;
import
com.a.eye.skywalking.api.plugin.PluginException
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
net.bytebuddy.agent.builder.AgentBuilder
;
import
net.bytebuddy.description.NamedElement
;
import
net.bytebuddy.description.type.TypeDescription
;
...
...
@@ -53,6 +54,8 @@ public class SkyWalkingAgent {
final
PluginFinder
pluginFinder
=
new
PluginFinder
(
new
PluginBootstrap
().
loadPlugins
());
ServiceStarter
.
INSTANCE
.
boot
();
new
AgentBuilder
.
Default
().
type
(
enhanceClassMatcher
(
pluginFinder
).
and
(
not
(
isInterface
()))).
transform
(
new
AgentBuilder
.
Transformer
()
{
public
DynamicType
.
Builder
<?>
transform
(
DynamicType
.
Builder
<?>
builder
,
TypeDescription
typeDescription
,
ClassLoader
classLoader
)
{
AbstractClassEnhancePluginDefine
pluginDefine
=
pluginFinder
.
find
(
typeDescription
.
getTypeName
());
...
...
skywalking-sniffer/skywalking-api/pom.xml
浏览文件 @
738d1564
...
...
@@ -21,15 +21,25 @@
<dependencies>
<dependency>
<groupId>
net.bytebuddy
</groupId>
<artifactId>
byte-buddy
</artifactId>
<version>
1.5.7
</version>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-trace
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-trace
</artifactId>
<artifactId>
skywalking-logging-api
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-collector-cluster
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
net.bytebuddy
</groupId>
<artifactId>
byte-buddy
</artifactId>
<version>
1.5.7
</version>
</dependency>
<dependency>
<groupId>
com.lmax
</groupId>
<artifactId>
disruptor
</artifactId>
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/BootService.java
0 → 100644
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.boot
;
/**
* The <code>BootService</code> is an interface to all services, which need to boot when plugin mechanism begins to
* work.
* {@link #bootUp()} will be called when <code>BootService</code> start up.
*
* @author wusheng
*/
public
interface
BootService
{
void
bootUp
();
}
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java
0 → 100644
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.boot
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.util.Iterator
;
import
java.util.ServiceLoader
;
/**
* The <code>ServiceStarter</code> bases on {@link ServiceLoader},
* load all {@link BootService} implementations.
*
* @author wusheng
*/
public
enum
ServiceStarter
{
INSTANCE
;
private
static
ILog
logger
=
LogManager
.
getLogger
(
StatusBootService
.
class
);
private
volatile
boolean
isStarted
=
false
;
public
void
boot
()
{
while
(!
isStarted
)
{
try
{
Iterator
<
BootService
>
serviceIterator
=
load
().
iterator
();
while
(
serviceIterator
.
hasNext
())
{
BootService
bootService
=
serviceIterator
.
next
();
try
{
bootService
.
bootUp
();
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
"ServiceStarter try to start [{}] fail."
,
bootService
.
getClass
().
getName
());
}
}
}
finally
{
isStarted
=
true
;
}
}
}
ServiceLoader
<
BootService
>
load
()
{
return
ServiceLoader
.
load
(
BootService
.
class
);
}
}
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/StatusBootService.java
0 → 100644
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.boot
;
/**
* The <code>StatusBootService</code> is an abstract implementations of {@link BootService},
* it extends {@link BootService}'s ability like this:
*
* If an implementation extends <code>StatusBootService</code>, it can know whether this service starts up successfully or not.
* It's based on {@link #bootUp()} function finished with or without an exception. if no exception, means start up successfully.
*
*
* @author wusheng
*/
public
abstract
class
StatusBootService
implements
BootService
{
private
volatile
boolean
started
=
false
;
protected
boolean
isStarted
(){
return
this
.
started
;
}
@Override
public
final
void
bootUp
(){
try
{
bootUpWithStatus
();
started
=
true
;
}
catch
(
Throwable
e
)
{
started
=
false
;
throw
e
;
}
}
protected
abstract
void
bootUpWithStatus
();
}
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/SnifferConfigInitializer.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.conf
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.util.ConfigInitializer
;
import
com.a.eye.skywalking.api.util.StringUtil
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/context/ContextManager.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.context
;
import
com.a.eye.skywalking.api.boot.BootService
;
import
com.a.eye.skywalking.api.queue.TraceSegmentProcessQueue
;
import
com.a.eye.skywalking.trace.Span
;
import
com.a.eye.skywalking.trace.TraceSegment
;
...
...
@@ -16,21 +17,10 @@ import com.a.eye.skywalking.trace.TraceSegment;
*
* Created by wusheng on 2017/2/17.
*/
public
enum
ContextManager
implements
TracerContextListener
{
INSTANCE
{
@Override
public
void
afterFinished
(
TraceSegment
traceSegment
)
{
CONTEXT
.
remove
();
}
};
ContextManager
()
{
TracerContext
.
ListenerManager
.
add
(
this
);
TraceSegmentProcessQueue
.
INSTANCE
.
start
();
}
public
class
ContextManager
implements
TracerContextListener
,
BootService
{
private
static
ThreadLocal
<
TracerContext
>
CONTEXT
=
new
ThreadLocal
<>();
private
TracerContext
get
()
{
private
static
TracerContext
get
()
{
TracerContext
segment
=
CONTEXT
.
get
();
if
(
segment
==
null
)
{
segment
=
new
TracerContext
();
...
...
@@ -42,28 +32,28 @@ public enum ContextManager implements TracerContextListener {
/**
* @see {@link TracerContext#inject(ContextCarrier)}
*/
public
void
inject
(
ContextCarrier
carrier
)
{
public
static
void
inject
(
ContextCarrier
carrier
)
{
get
().
inject
(
carrier
);
}
/**
*@see {@link TracerContext#extract(ContextCarrier)}
*/
public
void
extract
(
ContextCarrier
carrier
)
{
public
static
void
extract
(
ContextCarrier
carrier
)
{
get
().
extract
(
carrier
);
}
/**
* @see {@link TracerContext#extract(ContextCarrier)}
*/
public
void
multiExtract
(
ContextCarrier
carrier
){
public
static
void
multiExtract
(
ContextCarrier
carrier
){
get
().
extract
(
carrier
);
}
/**
* @return the {@link TraceSegment#traceSegmentId} if exist. Otherwise, "N/A".
*/
public
String
getTraceSegmentId
(){
public
static
String
getTraceSegmentId
(){
TracerContext
segment
=
CONTEXT
.
get
();
if
(
segment
==
null
){
return
"N/A"
;
...
...
@@ -72,27 +62,37 @@ public enum ContextManager implements TracerContextListener {
}
}
public
Span
createSpan
(
String
operationName
)
{
public
static
Span
createSpan
(
String
operationName
)
{
return
get
().
createSpan
(
operationName
);
}
public
Span
createSpan
(
String
operationName
,
long
startTime
)
{
return
get
().
createSpan
(
operationName
);
public
static
Span
createSpan
(
String
operationName
,
long
startTime
)
{
return
get
().
createSpan
(
operationName
,
startTime
);
}
public
Span
activeSpan
()
{
public
static
Span
activeSpan
()
{
return
get
().
activeSpan
();
}
public
void
stopSpan
(
Span
span
)
{
public
static
void
stopSpan
(
Span
span
)
{
get
().
stopSpan
(
span
);
}
public
void
stopSpan
(
Long
endTime
)
{
public
static
void
stopSpan
(
Long
endTime
)
{
get
().
stopSpan
(
activeSpan
(),
endTime
);
}
public
void
stopSpan
()
{
public
static
void
stopSpan
()
{
stopSpan
(
activeSpan
());
}
@Override
public
void
bootUp
(){
TracerContext
.
ListenerManager
.
add
(
this
);
}
@Override
public
void
afterFinished
(
TraceSegment
traceSegment
)
{
CONTEXT
.
remove
();
}
}
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/logging/EasyLogResolver.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.logging
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogResolver
;
/**
* Created by wusheng on 2016/11/26.
*/
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/logging/EasyLogger.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.logging
;
import
com.a.eye.skywalking.logging.ILog
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/AbstractClassEnhancePluginDefine.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.ClassEnhancePluginDefine
;
import
com.a.eye.skywalking.api.util.StringUtil
;
import
net.bytebuddy.dynamic.DynamicType
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/PluginBootstrap.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin
;
import
com.a.eye.skywalking.api.logging.ILog
;
import
com.a.eye.skywalking.api.logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
net.bytebuddy.pool.TypePool
;
import
java.net.URL
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/PluginResourcesResolver.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.io.IOException
;
import
java.net.URL
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/TracingBootstrap.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
net.bytebuddy.ByteBuddy
;
import
net.bytebuddy.dynamic.ClassFileLocator
;
import
net.bytebuddy.dynamic.DynamicType
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassConstructorInterceptor.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.enhance
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.loader.InterceptorInstanceLoader
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
net.bytebuddy.implementation.bind.annotation.AllArguments
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassEnhancePluginDefine.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.enhance
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.AbstractClassEnhancePluginDefine
;
import
com.a.eye.skywalking.api.plugin.PluginException
;
import
com.a.eye.skywalking.api.plugin.interceptor.ConstructorInterceptPoint
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassInstanceMethodsInterceptor.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.enhance
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.loader.InterceptorInstanceLoader
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
net.bytebuddy.implementation.bind.annotation.*
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/ClassStaticMethodsInterceptor.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.enhance
;
import
com.a.eye.skywalking.api.logging.ILog
;
import
com.a.eye.skywalking.api.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.loader.InterceptorInstanceLoader
;
import
net.bytebuddy.implementation.bind.annotation.AllArguments
;
import
net.bytebuddy.implementation.bind.annotation.Origin
;
import
net.bytebuddy.implementation.bind.annotation.RuntimeType
;
import
net.bytebuddy.implementation.bind.annotation.SuperCall
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.lang.reflect.Method
;
import
java.util.concurrent.Callable
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/enhance/DefaultClassConstructorInterceptor.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.enhance
;
import
com.a.eye.skywalking.api.logging.ILog
;
import
com.a.eye.skywalking.api.logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
net.bytebuddy.implementation.bind.annotation.AllArguments
;
import
net.bytebuddy.implementation.bind.annotation.FieldProxy
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/plugin/interceptor/loader/InterceptorInstanceLoader.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.plugin.interceptor.loader
;
import
com.a.eye.skywalking.api.logging.ILog
;
import
com.a.eye.skywalking.api.logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
java.io.BufferedInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.api.queue
;
import
com.a.eye.skywalking.api.boot.StatusBootService
;
import
com.a.eye.skywalking.api.conf.Config
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.context.TracerContextListener
;
...
...
@@ -15,30 +16,31 @@ import com.lmax.disruptor.util.DaemonThreadFactory;
*
* Created by wusheng on 2017/2/17.
*/
public
enum
TraceSegmentProcessQueue
implements
TracerContextListener
{
INSTANCE
{
@Override
public
void
afterFinished
(
TraceSegment
traceSegment
)
{
long
sequence
=
this
.
buffer
.
next
();
// Grab the next sequence
try
{
TraceSegmentHolder
data
=
this
.
buffer
.
get
(
sequence
);
data
.
setValue
(
traceSegment
);
}
finally
{
this
.
buffer
.
publish
(
sequence
);
}
}
};
public
class
TraceSegmentProcessQueue
extends
StatusBootService
implements
TracerContextListener
{
private
Disruptor
<
TraceSegmentHolder
>
disruptor
;
RingBuffer
<
TraceSegmentHolder
>
buffer
;
private
RingBuffer
<
TraceSegmentHolder
>
buffer
;
TraceSegmentProcessQueue
()
{
public
TraceSegmentProcessQueue
()
{
disruptor
=
new
Disruptor
<>(
TraceSegmentHolder
.
Factory
.
INSTANCE
,
Config
.
Disruptor
.
BUFFER_SIZE
,
DaemonThreadFactory
.
INSTANCE
);
buffer
=
disruptor
.
getRingBuffer
();
}
public
void
start
()
{
@Override
protected
void
bootUpWithStatus
()
{
TracerContext
.
ListenerManager
.
add
(
this
);
disruptor
.
start
();
}
@Override
public
void
afterFinished
(
TraceSegment
traceSegment
)
{
if
(
isStarted
())
{
long
sequence
=
this
.
buffer
.
next
();
// Grab the next sequence
try
{
TraceSegmentHolder
data
=
this
.
buffer
.
get
(
sequence
);
data
.
setValue
(
traceSegment
);
}
finally
{
this
.
buffer
.
publish
(
sequence
);
}
}
}
}
skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService
0 → 100644
浏览文件 @
738d1564
com.a.eye.skywalking.api.queue.TraceSegmentProcessQueue
com.a.eye.skywalking.api.context.ContextManager
skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api/context/ContextManagerTestCase.java
浏览文件 @
738d1564
...
...
@@ -13,13 +13,13 @@ import org.junit.Test;
public
class
ContextManagerTestCase
{
@Test
public
void
testDelegateToTracerContext
(){
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"serviceA"
);
Span
span
=
ContextManager
.
createSpan
(
"serviceA"
);
Tags
.
COMPONENT
.
set
(
span
,
"test"
);
Assert
.
assertEquals
(
span
,
ContextManager
.
INSTANCE
.
activeSpan
());
Assert
.
assertEquals
(
span
,
ContextManager
.
activeSpan
());
TracerContext
.
ListenerManager
.
add
(
TestTracerContextListener
.
INSTANCE
);
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
TraceSegment
segment
=
TestTracerContextListener
.
INSTANCE
.
finishedSegmentCarrier
[
0
];
...
...
skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/main/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptor.java
浏览文件 @
738d1564
...
...
@@ -51,7 +51,7 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
boolean
isConsumer
=
rpcContext
.
isConsumerSide
();
URL
requestURL
=
invoker
.
getUrl
();
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
generateOperationName
(
requestURL
,
invocation
));
Span
span
=
ContextManager
.
createSpan
(
generateOperationName
(
requestURL
,
invocation
));
Tags
.
URL
.
set
(
span
,
generateRequestURL
(
requestURL
,
invocation
));
Tags
.
COMPONENT
.
set
(
span
,
DUBBO_COMPONENT
);
Tags
.
SPAN_LAYER
.
asRPCFramework
(
span
);
...
...
@@ -61,7 +61,7 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
Tags
.
PEER_PORT
.
set
(
span
,
requestURL
.
getPort
());
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
ContextManager
.
INSTANCE
.
inject
(
contextCarrier
);
ContextManager
.
inject
(
contextCarrier
);
if
(!
BugFixActive
.
isActive
())
{
//invocation.getAttachments().put("contextData", contextDataStr);
//@see https://github.com/alibaba/dubbo/blob/dubbo-2.5.3/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java#L154-L161
...
...
@@ -80,7 +80,7 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
}
if
(
contextCarrier
!=
null
)
{
ContextManager
.
INSTANCE
.
extract
(
contextCarrier
);
ContextManager
.
extract
(
contextCarrier
);
}
}
}
...
...
@@ -98,7 +98,7 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
dealException
(
result
.
getException
());
}
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
return
ret
;
}
...
...
@@ -112,7 +112,7 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
* Log the throwable, which occurs in Dubbo RPC service.
*/
private
void
dealException
(
Throwable
throwable
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
throwable
);
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.dubbo
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
...
...
@@ -59,6 +60,8 @@ public class DubboInterceptorTest {
@Before
public
void
setUp
()
throws
Exception
{
ServiceStarter
.
INSTANCE
.
boot
();
dubboInterceptor
=
new
DubboInterceptor
();
testParam
=
new
RequestParamForTestBelow283
();
mockTracerContextListener
=
new
MockTracerContextListener
();
...
...
@@ -226,4 +229,4 @@ public class DubboInterceptorTest {
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/pom.xml
浏览文件 @
738d1564
...
...
@@ -23,7 +23,7 @@
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-api
</artifactId>
<version>
3.0-2017
</version>
<version>
${project.version}
</version>
</dependency>
...
...
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptor.java
浏览文件 @
738d1564
...
...
@@ -48,7 +48,7 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
Tags
.
SPAN_LAYER
.
asHttp
(
span
);
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
ContextManager
.
INSTANCE
.
inject
(
contextCarrier
);
ContextManager
.
inject
(
contextCarrier
);
httpRequest
.
setHeader
(
HEADER_NAME_OF_CONTEXT_DATA
,
contextCarrier
.
serialize
());
}
...
...
@@ -68,9 +68,9 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
Span
span
;
try
{
URL
url
=
new
URL
(
httpRequest
.
getRequestLine
().
getUri
());
span
=
ContextManager
.
INSTANCE
.
createSpan
(
url
.
getPath
());
span
=
ContextManager
.
createSpan
(
url
.
getPath
());
}
catch
(
MalformedURLException
e
)
{
span
=
ContextManager
.
INSTANCE
.
createSpan
(
httpRequest
.
getRequestLine
().
getUri
());
span
=
ContextManager
.
createSpan
(
httpRequest
.
getRequestLine
().
getUri
());
}
return
span
;
}
...
...
@@ -85,20 +85,20 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
HttpResponse
response
=
(
HttpResponse
)
ret
;
int
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
if
(
statusCode
!=
200
)
{
Tags
.
ERROR
.
set
(
span
,
true
);
}
Tags
.
STATUS_CODE
.
set
(
span
,
statusCode
);
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
)
{
Tags
.
ERROR
.
set
(
ContextManager
.
INSTANCE
.
activeSpan
(),
true
);
ContextManager
.
INSTANCE
.
activeSpan
().
log
(
t
);
Tags
.
ERROR
.
set
(
ContextManager
.
activeSpan
(),
true
);
ContextManager
.
activeSpan
().
log
(
t
);
}
}
skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.httpClient.v4
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
...
...
@@ -56,6 +57,8 @@ public class HttpClientExecuteInterceptorTest {
@Before
public
void
setUp
()
throws
Exception
{
mockTracerContextListener
=
new
MockTracerContextListener
();
ServiceStarter
.
INSTANCE
.
boot
();
httpClientExecuteInterceptor
=
new
HttpClientExecuteInterceptor
();
PowerMockito
.
mock
(
HttpHost
.
class
);
...
...
@@ -163,4 +166,4 @@ public class HttpClientExecuteInterceptorTest {
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/CallableStatementTracing.java
浏览文件 @
738d1564
...
...
@@ -22,7 +22,7 @@ public class CallableStatementTracing {
ConnectionInfo
connectInfo
,
String
method
,
String
sql
,
Executable
<
R
>
exec
)
throws
SQLException
{
try
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"JDBC/CallableStatement/"
+
method
);
Span
span
=
ContextManager
.
createSpan
(
"JDBC/CallableStatement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
...
...
@@ -36,12 +36,12 @@ public class CallableStatementTracing {
}
return
exec
.
exe
(
realStatement
,
sql
);
}
catch
(
SQLException
e
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
e
);
throw
e
;
}
finally
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
浏览文件 @
738d1564
...
...
@@ -22,7 +22,7 @@ public class ConnectionTracing {
ConnectionInfo
connectInfo
,
String
method
,
String
sql
,
Executable
<
R
>
exec
)
throws
SQLException
{
try
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"JDBC/Connection/"
+
method
);
Span
span
=
ContextManager
.
createSpan
(
"JDBC/Connection/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
...
...
@@ -36,12 +36,12 @@ public class ConnectionTracing {
}
return
exec
.
exe
(
realConnection
,
sql
);
}
catch
(
SQLException
e
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
e
);
throw
e
;
}
finally
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
浏览文件 @
738d1564
...
...
@@ -21,7 +21,7 @@ public class PreparedStatementTracing {
ConnectionInfo
connectInfo
,
String
method
,
String
sql
,
Executable
<
R
>
exec
)
throws
SQLException
{
try
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"JDBC/PreparedStatement/"
+
method
);
Span
span
=
ContextManager
.
createSpan
(
"JDBC/PreparedStatement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
...
...
@@ -35,12 +35,12 @@ public class PreparedStatementTracing {
Tags
.
SPAN_LAYER
.
asDB
(
span
);
return
exec
.
exe
(
realStatement
,
sql
);
}
catch
(
SQLException
e
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
e
);
throw
e
;
}
finally
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
浏览文件 @
738d1564
...
...
@@ -21,7 +21,7 @@ public class StatementTracing {
ConnectionInfo
connectInfo
,
String
method
,
String
sql
,
Executable
<
R
>
exec
)
throws
SQLException
{
try
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"JDBC/Statement/"
+
method
);
Span
span
=
ContextManager
.
createSpan
(
"JDBC/Statement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
...
...
@@ -35,12 +35,12 @@ public class StatementTracing {
}
return
exec
.
exe
(
realStatement
,
sql
);
}
catch
(
SQLException
e
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
e
);
throw
e
;
}
finally
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.jdbc
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener
;
import
com.a.eye.skywalking.sniffer.mock.context.SegmentAssert
;
...
...
@@ -89,6 +90,7 @@ public class SWCallableStatementTest extends AbstractStatementTest {
@Before
public
void
setUp
()
throws
Exception
{
mockTracerContextListener
=
new
MockTracerContextListener
();
ServiceStarter
.
INSTANCE
.
boot
();
swConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306/test"
,
new
Properties
(),
jdbcConnection
);
multiHostConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test"
,
new
Properties
(),
jdbcConnection
);
...
...
@@ -749,4 +751,4 @@ public class SWCallableStatementTest extends AbstractStatementTest {
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.jdbc
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener
;
import
com.a.eye.skywalking.sniffer.mock.context.SegmentAssert
;
...
...
@@ -48,6 +49,8 @@ public class SWStatementTest extends AbstractStatementTest {
@Before
public
void
setUp
()
throws
Exception
{
mockTracerContextListener
=
new
MockTracerContextListener
();
ServiceStarter
.
INSTANCE
.
boot
();
swConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306/test"
,
new
Properties
(),
jdbcConnection
);
multiHostConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test"
,
new
Properties
(),
jdbcConnection
);
...
...
@@ -306,4 +309,4 @@ public class SWStatementTest extends AbstractStatementTest {
public
void
tearDown
()
throws
Exception
{
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.jdbc
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener
;
import
com.a.eye.skywalking.sniffer.mock.context.SegmentAssert
;
...
...
@@ -89,6 +90,8 @@ public class SwPreparedStatementTest extends AbstractStatementTest {
@Before
public
void
setUp
()
throws
Exception
{
mockTracerContextListener
=
new
MockTracerContextListener
();
ServiceStarter
.
INSTANCE
.
boot
();
swConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306/test"
,
new
Properties
(),
jdbcConnection
);
multiHostConnection
=
new
SWConnection
(
"jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test"
,
new
Properties
(),
jdbcConnection
);
...
...
@@ -580,4 +583,4 @@ public class SwPreparedStatementTest extends AbstractStatementTest {
public
void
tearDown
()
throws
Exception
{
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptor.java
浏览文件 @
738d1564
...
...
@@ -46,7 +46,7 @@ public class JedisMethodInterceptor extends NoCocurrencyAceessObject {
this
.
whenEnter
(
context
,
new
Runnable
()
{
@Override
public
void
run
()
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"Jedis/"
+
interceptorContext
.
methodName
());
Span
span
=
ContextManager
.
createSpan
(
"Jedis/"
+
interceptorContext
.
methodName
());
Tags
.
COMPONENT
.
set
(
span
,
REDIS_COMPONENT
);
Tags
.
DB_TYPE
.
set
(
span
,
REDIS_COMPONENT
);
tagPeer
(
span
,
context
);
...
...
@@ -84,7 +84,7 @@ public class JedisMethodInterceptor extends NoCocurrencyAceessObject {
this
.
whenExist
(
context
,
new
Runnable
()
{
@Override
public
void
run
()
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
});
return
ret
;
...
...
@@ -92,6 +92,6 @@ public class JedisMethodInterceptor extends NoCocurrencyAceessObject {
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
)
{
ContextManager
.
INSTANCE
.
activeSpan
().
log
(
t
);
ContextManager
.
activeSpan
().
log
(
t
);
}
}
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.jedis.v2
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
...
...
@@ -46,6 +47,8 @@ public class JedisMethodInterceptorTest {
@Before
public
void
setUp
()
throws
Exception
{
ServiceStarter
.
INSTANCE
.
boot
();
interceptor
=
new
JedisMethodInterceptor
();
mockTracerContextListener
=
new
MockTracerContextListener
();
...
...
@@ -149,4 +152,4 @@ public class JedisMethodInterceptorTest {
TracerContext
.
ListenerManager
.
remove
(
mockTracerContextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptor.java
浏览文件 @
738d1564
...
...
@@ -49,7 +49,7 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
URL
url
=
(
URL
)
context
.
get
(
KEY_NAME_OF_REQUEST_URL
);
Request
request
=
(
Request
)
interceptorContext
.
allArguments
()[
0
];
if
(
url
!=
null
)
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
generateOperationName
(
url
,
request
));
Span
span
=
ContextManager
.
createSpan
(
generateOperationName
(
url
,
request
));
Tags
.
PEER_HOST
.
set
(
span
,
url
.
getHost
());
Tags
.
PEER_PORT
.
set
(
span
,
url
.
getPort
());
Tags
.
COMPONENT
.
set
(
span
,
MOTAN_COMPONENT
);
...
...
@@ -58,7 +58,7 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
Tags
.
SPAN_LAYER
.
asRPCFramework
(
span
);
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
ContextManager
.
INSTANCE
.
inject
(
contextCarrier
);
ContextManager
.
inject
(
contextCarrier
);
request
.
setAttachment
(
ATTACHMENT_KEY_OF_CONTEXT_DATA
,
contextCarrier
.
serialize
());
}
}
...
...
@@ -68,18 +68,18 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
Object
ret
)
{
Response
response
=
(
Response
)
ret
;
if
(
response
!=
null
&&
response
.
getException
()
!=
null
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
ERROR
.
set
(
span
,
true
);
span
.
log
(
response
.
getException
());
}
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
)
{
ContextManager
.
INSTANCE
.
activeSpan
().
log
(
t
);
ContextManager
.
activeSpan
().
log
(
t
);
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/main/java/com/a/eye/skywalking/plugin/motan/MotanProviderInterceptor.java
浏览文件 @
738d1564
...
...
@@ -37,14 +37,14 @@ public class MotanProviderInterceptor implements InstanceMethodsAroundIntercepto
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
Request
request
=
(
Request
)
interceptorContext
.
allArguments
()[
0
];
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
generateViewPoint
(
request
));
Span
span
=
ContextManager
.
createSpan
(
generateViewPoint
(
request
));
Tags
.
COMPONENT
.
set
(
span
,
MOTAN_COMPONENT
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_SERVER
);
Tags
.
SPAN_LAYER
.
asRPCFramework
(
span
);
String
serializedContextData
=
request
.
getAttachments
().
get
(
ATTACHMENT_KEY_OF_CONTEXT_DATA
);
if
(!
StringUtil
.
isEmpty
(
serializedContextData
))
{
ContextManager
.
INSTANCE
.
extract
(
new
ContextCarrier
().
deserialize
(
serializedContextData
));
ContextManager
.
extract
(
new
ContextCarrier
().
deserialize
(
serializedContextData
));
}
}
...
...
@@ -53,19 +53,19 @@ public class MotanProviderInterceptor implements InstanceMethodsAroundIntercepto
Object
ret
)
{
Response
response
=
(
Response
)
ret
;
if
(
response
!=
null
&&
response
.
getException
()
!=
null
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
span
.
log
(
response
.
getException
());
Tags
.
ERROR
.
set
(
span
,
true
);
}
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
)
{
ContextManager
.
INSTANCE
.
activeSpan
().
log
(
t
);
ContextManager
.
activeSpan
().
log
(
t
);
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.motan
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
...
...
@@ -51,6 +52,8 @@ public class MotanConsumerInterceptorTest {
@Before
public
void
setUp
()
{
ServiceStarter
.
INSTANCE
.
boot
();
contextListener
=
new
MockTracerContextListener
();
invokeInterceptor
=
new
MotanConsumerInterceptor
();
url
=
URL
.
valueOf
(
"motan://127.0.0.1:34000/com.a.eye.skywalking.test.TestService"
);
...
...
@@ -139,4 +142,4 @@ public class MotanConsumerInterceptorTest {
public
void
tearDown
()
{
TracerContext
.
ListenerManager
.
remove
(
contextListener
);
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptor.java
浏览文件 @
738d1564
...
...
@@ -41,7 +41,7 @@ public class TomcatInterceptor implements InstanceMethodsAroundInterceptor {
Object
[]
args
=
interceptorContext
.
allArguments
();
HttpServletRequest
request
=
(
HttpServletRequest
)
args
[
0
];
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
request
.
getRequestURI
());
Span
span
=
ContextManager
.
createSpan
(
request
.
getRequestURI
());
Tags
.
COMPONENT
.
set
(
span
,
TOMCAT_COMPONENT
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_SERVER
);
Tags
.
URL
.
set
(
span
,
request
.
getRequestURL
().
toString
());
...
...
@@ -49,7 +49,7 @@ public class TomcatInterceptor implements InstanceMethodsAroundInterceptor {
String
tracingHeaderValue
=
request
.
getHeader
(
HEADER_NAME_OF_CONTEXT_DATA
);
if
(!
StringUtil
.
isEmpty
(
tracingHeaderValue
))
{
ContextManager
.
INSTANCE
.
extract
(
new
ContextCarrier
().
deserialize
(
tracingHeaderValue
));
ContextManager
.
extract
(
new
ContextCarrier
().
deserialize
(
tracingHeaderValue
));
}
}
...
...
@@ -57,21 +57,21 @@ public class TomcatInterceptor implements InstanceMethodsAroundInterceptor {
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
HttpServletResponse
response
=
(
HttpServletResponse
)
interceptorContext
.
allArguments
()[
1
];
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
Tags
.
STATUS_CODE
.
set
(
span
,
response
.
getStatus
());
if
(
response
.
getStatus
()
!=
200
)
{
Tags
.
ERROR
.
set
(
span
,
true
);
}
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
)
{
Span
span
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
span
=
ContextManager
.
activeSpan
();
span
.
log
(
t
);
Tags
.
ERROR
.
set
(
span
,
true
);
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.plugin.tomcat78x
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
...
...
@@ -48,6 +49,9 @@ public class TomcatInterceptorTest {
@Before
public
void
setUp
()
throws
Exception
{
ServiceStarter
.
INSTANCE
.
boot
();
tomcatInterceptor
=
new
TomcatInterceptor
();
contextListener
=
new
MockTracerContextListener
();
...
...
@@ -139,4 +143,4 @@ public class TomcatInterceptorTest {
TracerContext
.
ListenerManager
.
remove
(
new
MockTracerContextListener
());
}
}
\ No newline at end of file
}
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/DubboSpanGenerator.java
浏览文件 @
738d1564
...
...
@@ -13,7 +13,7 @@ import com.a.eye.skywalking.trace.tag.Tags;
public
class
DubboSpanGenerator
{
public
static
class
Client
extends
SpanGeneration
{
@Override
protected
void
before
()
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query"
);
Span
span
=
ContextManager
.
createSpan
(
"/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query"
);
Tags
.
COMPONENT
.
set
(
span
,
"Dubbo"
);
Tags
.
URL
.
set
(
span
,
"rest://192.168.1.8:20880/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query(String)"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_SERVER
);
...
...
@@ -23,13 +23,13 @@ public class DubboSpanGenerator {
}
@Override
protected
void
after
()
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
public
static
class
Server
extends
SpanGeneration
{
@Override
protected
void
before
()
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query"
);
Span
span
=
ContextManager
.
createSpan
(
"/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query"
);
Tags
.
COMPONENT
.
set
(
span
,
"Dubbo"
);
Tags
.
URL
.
set
(
span
,
"rest://192.168.1.8:20880/default_rpc/com.a.eye.skywalking.test.persistence.PersistenceService.query(String)"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
...
...
@@ -38,7 +38,7 @@ public class DubboSpanGenerator {
}
@Override
protected
void
after
()
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
}
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/MySQLGenerator.java
浏览文件 @
738d1564
...
...
@@ -12,7 +12,7 @@ import com.a.eye.skywalking.trace.tag.Tags;
public
class
MySQLGenerator
{
public
static
class
Query
extends
SpanGeneration
{
@Override
protected
void
before
()
{
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
"mysql/jdbi/statement/executeQuery"
);
Span
span
=
ContextManager
.
createSpan
(
"mysql/jdbi/statement/executeQuery"
);
Tags
.
COMPONENT
.
set
(
span
,
"Mysql"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
Tags
.
PEER_HOST
.
set
(
span
,
"10.5.34.18"
);
...
...
@@ -24,7 +24,7 @@ public class MySQLGenerator {
}
@Override
protected
void
after
()
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
}
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/trace/builders/span/TomcatSpanGenerator.java
浏览文件 @
738d1564
...
...
@@ -14,7 +14,7 @@ public class TomcatSpanGenerator{
public
static
final
ON200
INSTANCE
=
new
ON200
();
@Override
protected
void
before
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
createSpan
(
"/web/serviceA"
);
Span
webSpan
=
ContextManager
.
createSpan
(
"/web/serviceA"
);
Tags
.
COMPONENT
.
set
(
webSpan
,
"Tomcat"
);
Tags
.
URL
.
set
(
webSpan
,
"http://10.21.9.35/web/serviceA"
);
Tags
.
SPAN_KIND
.
set
(
webSpan
,
Tags
.
SPAN_KIND_SERVER
);
...
...
@@ -24,9 +24,9 @@ public class TomcatSpanGenerator{
}
@Override
protected
void
after
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
webSpan
=
ContextManager
.
activeSpan
();
Tags
.
STATUS_CODE
.
set
(
webSpan
,
200
);
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
...
...
@@ -34,7 +34,7 @@ public class TomcatSpanGenerator{
public
static
final
ON404
INSTANCE
=
new
ON404
();
@Override
protected
void
before
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
createSpan
(
"/web/service/unknown"
);
Span
webSpan
=
ContextManager
.
createSpan
(
"/web/service/unknown"
);
Tags
.
COMPONENT
.
set
(
webSpan
,
"Tomcat"
);
Tags
.
URL
.
set
(
webSpan
,
"http://10.21.9.35/web/unknown"
);
Tags
.
SPAN_KIND
.
set
(
webSpan
,
Tags
.
SPAN_KIND_SERVER
);
...
...
@@ -44,17 +44,17 @@ public class TomcatSpanGenerator{
}
@Override
protected
void
after
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
webSpan
=
ContextManager
.
activeSpan
();
Tags
.
STATUS_CODE
.
set
(
webSpan
,
404
);
Tags
.
ERROR
.
set
(
webSpan
,
true
);
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
public
static
class
ON500
extends
SpanGeneration
{
public
static
final
ON500
INSTANCE
=
new
ON500
();
@Override
protected
void
before
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
createSpan
(
"/web/error/service"
);
Span
webSpan
=
ContextManager
.
createSpan
(
"/web/error/service"
);
Tags
.
COMPONENT
.
set
(
webSpan
,
"Tomcat"
);
Tags
.
URL
.
set
(
webSpan
,
"http://10.21.9.35/web/error/service"
);
Tags
.
SPAN_KIND
.
set
(
webSpan
,
Tags
.
SPAN_KIND_SERVER
);
...
...
@@ -64,11 +64,11 @@ public class TomcatSpanGenerator{
}
@Override
protected
void
after
()
{
Span
webSpan
=
ContextManager
.
INSTANCE
.
activeSpan
();
Span
webSpan
=
ContextManager
.
activeSpan
();
Tags
.
STATUS_CODE
.
set
(
webSpan
,
500
);
Tags
.
ERROR
.
set
(
webSpan
,
true
);
webSpan
.
log
(
new
NumberFormatException
(
"Can't convert 'abc' to int."
));
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
}
}
skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java
浏览文件 @
738d1564
package
com.a.eye.skywalking.sniffer.mock
;
import
com.a.eye.skywalking.api.boot.ServiceStarter
;
import
com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener
;
import
com.a.eye.skywalking.sniffer.mock.context.SegmentAssert
;
import
com.a.eye.skywalking.sniffer.mock.trace.TraceSegmentBuilderFactory
;
import
com.a.eye.skywalking.trace.TraceSegment
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
/**
* Created by wusheng on 2017/2/21.
*/
public
class
MockTracerContextListenerTestCase
{
@BeforeClass
public
static
void
setup
(){
ServiceStarter
.
INSTANCE
.
boot
();
}
@Test
public
void
testAfterFinished
(){
MockTracerContextListener
listener
=
new
MockTracerContextListener
();
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/log4j/v1/x/PrintTraceIdInterceptor.java
浏览文件 @
738d1564
...
...
@@ -26,7 +26,7 @@ public class PrintTraceIdInterceptor implements InstanceMethodsAroundInterceptor
*/
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
return
"TID:"
+
ContextManager
.
INSTANCE
.
getTraceSegmentId
();
return
"TID:"
+
ContextManager
.
getTraceSegmentId
();
}
@Override
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/log4j/v2/x/PrintTraceIdInterceptor.java
浏览文件 @
738d1564
...
...
@@ -19,7 +19,7 @@ public class PrintTraceIdInterceptor implements StaticMethodsAroundInterceptor {
*/
@Override
public
void
beforeMethod
(
StaticMethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
((
StringBuilder
)
interceptorContext
.
allArguments
()[
0
]).
append
(
"TID:"
+
ContextManager
.
INSTANCE
.
getTraceSegmentId
());
((
StringBuilder
)
interceptorContext
.
allArguments
()[
0
]).
append
(
"TID:"
+
ContextManager
.
getTraceSegmentId
());
//make sure origin method do not invoke.
result
.
defineReturnValue
(
null
);
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-logback-1.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log/logback/v1/x/PrintTraceIdInterceptor.java
浏览文件 @
738d1564
...
...
@@ -25,7 +25,7 @@ public class PrintTraceIdInterceptor implements InstanceMethodsAroundInterceptor
*/
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
return
"TID:"
+
ContextManager
.
INSTANCE
.
getTraceSegmentId
();
return
"TID:"
+
ContextManager
.
getTraceSegmentId
();
}
@Override
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/pom.xml
浏览文件 @
738d1564
...
...
@@ -21,6 +21,7 @@
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-toolkit-opentracing
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanFinishInterceptor.java
浏览文件 @
738d1564
...
...
@@ -22,9 +22,9 @@ public class SpanFinishInterceptor implements InstanceMethodsAroundInterceptor {
Object
[]
allArguments
=
interceptorContext
.
allArguments
();
if
(
allArguments
.
length
==
1
)
{
ContextManager
.
INSTANCE
.
stopSpan
(((
Long
)
allArguments
[
0
]));
ContextManager
.
stopSpan
(((
Long
)
allArguments
[
0
]));
}
else
{
ContextManager
.
INSTANCE
.
stopSpan
();
ContextManager
.
stopSpan
();
}
return
ret
;
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanNewInstanceInterceptor.java
浏览文件 @
738d1564
...
...
@@ -19,7 +19,7 @@ public class SpanNewInstanceInterceptor implements InstanceConstructorIntercepto
String
operationName
=
((
String
)
allArguments
[
0
]);
long
startTime
=
((
Long
)
allArguments
[
1
]);
Map
<
String
,
String
>
tags
=
((
Map
<
String
,
String
>)
allArguments
[
2
]);
Span
span
=
ContextManager
.
INSTANCE
.
createSpan
(
operationName
,
startTime
);
Span
span
=
ContextManager
.
createSpan
(
operationName
,
startTime
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
tags
.
entrySet
())
{
span
.
setTag
(
entry
.
getKey
(),
entry
.
getValue
());
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanSetOperationNameInterceptor.java
浏览文件 @
738d1564
...
...
@@ -15,7 +15,7 @@ public class SpanSetOperationNameInterceptor implements InstanceMethodsAroundInt
@Override
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
String
operationName
=
(
String
)
interceptorContext
.
allArguments
()[
0
];
ContextManager
.
INSTANCE
.
activeSpan
().
setOperationName
(
operationName
);
ContextManager
.
activeSpan
().
setOperationName
(
operationName
);
}
@Override
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/span/interceptor/SpanSetTagInterceptor.java
浏览文件 @
738d1564
...
...
@@ -21,11 +21,11 @@ public class SpanSetTagInterceptor implements InstanceMethodsAroundInterceptor {
String
key
=
(
String
)
interceptorContext
.
allArguments
()[
0
];
Object
value
=
interceptorContext
.
allArguments
()[
1
];
if
(
value
instanceof
String
)
ContextManager
.
INSTANCE
.
activeSpan
().
setTag
(
key
,
(
String
)
value
);
ContextManager
.
activeSpan
().
setTag
(
key
,
(
String
)
value
);
else
if
(
value
instanceof
Boolean
)
ContextManager
.
INSTANCE
.
activeSpan
().
setTag
(
key
,
(
Boolean
)
value
);
ContextManager
.
activeSpan
().
setTag
(
key
,
(
Boolean
)
value
);
else
if
(
value
instanceof
Number
)
ContextManager
.
INSTANCE
.
activeSpan
().
setTag
(
key
,
(
Number
)
value
);
ContextManager
.
activeSpan
().
setTag
(
key
,
(
Number
)
value
);
}
@Override
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerExtractCrossProcessByteBufferContextInterceptor.java
浏览文件 @
738d1564
...
...
@@ -29,7 +29,7 @@ public class TracerExtractCrossProcessByteBufferContextInterceptor implements In
ContextCarrier
carrier
=
new
ContextCarrier
();
carrier
.
deserialize
(
contextDataStr
);
ContextManager
.
INSTANCE
.
extract
(
carrier
);
ContextManager
.
extract
(
carrier
);
return
ret
;
}
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerExtractCrossProcessTextMapContextInterceptor.java
浏览文件 @
738d1564
...
...
@@ -35,7 +35,7 @@ public class TracerExtractCrossProcessTextMapContextInterceptor implements Insta
ContextCarrier
carrier
=
new
ContextCarrier
();
carrier
.
deserialize
(
entry
.
getValue
());
ContextManager
.
INSTANCE
.
extract
(
carrier
);
ContextManager
.
extract
(
carrier
);
}
}
return
ret
;
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-opentracing-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/opentracing/tracer/interceptor/TracerFormatCrossProcessContextInterceptor.java
浏览文件 @
738d1564
...
...
@@ -20,7 +20,7 @@ public class TracerFormatCrossProcessContextInterceptor implements InstanceMetho
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
ContextCarrier
carrier
=
new
ContextCarrier
();
ContextManager
.
INSTANCE
.
inject
(
carrier
);
ContextManager
.
inject
(
carrier
);
return
carrier
.
serialize
();
}
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-trace-context-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/trace/TraceContextInterceptor.java
浏览文件 @
738d1564
...
...
@@ -2,8 +2,8 @@ package com.a.eye.skywalking.toolkit.activation.trace;
import
com.a.eye.skywalking.api.context.ContextCarrier
;
import
com.a.eye.skywalking.api.context.ContextManager
;
import
com.a.eye.skywalking.
api.
logging.ILog
;
import
com.a.eye.skywalking.
api.
logging.LogManager
;
import
com.a.eye.skywalking.logging.ILog
;
import
com.a.eye.skywalking.logging.LogManager
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.MethodInterceptResult
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.MethodInvokeContext
;
import
com.a.eye.skywalking.api.plugin.interceptor.enhance.StaticMethodInvokeContext
;
...
...
@@ -25,7 +25,7 @@ public class TraceContextInterceptor implements StaticMethodsAroundInterceptor {
@Override
public
Object
afterMethod
(
StaticMethodInvokeContext
interceptorContext
,
Object
ret
)
{
ContextCarrier
carrier
=
new
ContextCarrier
();
ContextManager
.
INSTANCE
.
inject
(
carrier
);
ContextManager
.
inject
(
carrier
);
return
carrier
.
getTraceSegmentId
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录