修复部分问题
This commit is contained in:
parent
e04fbee8dc
commit
2c3e3ce33f
|
|
@ -17,5 +17,6 @@
|
|||
<module>skywalking-toolkit-log4j-1.x</module>
|
||||
<module>skywalking-toolkit-log4j-2.x</module>
|
||||
<module>skywalking-toolkit-logback-1.x</module>
|
||||
<module>skywalking-toolkit-trace-context</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<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-application-toolkit</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>2.0-2016</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-toolkit-trace-context</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>skywalking-toolkit-trace-context</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.a.eye.skywalking.toolkit.trace;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/12/15.
|
||||
*/
|
||||
public class TraceContext {
|
||||
|
||||
public static String traceId() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,12 @@
|
|||
<artifactId>skywalking-toolkit-logback-1.x-activation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-toolkit-trace-context-activation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${artifactId}</finalName>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<module>skywalking-toolkit-log4j-1.x-activation</module>
|
||||
<module>skywalking-toolkit-log4j-2.x-activation</module>
|
||||
<module>skywalking-toolkit-logback-1.x-activation</module>
|
||||
<module>skywalking-toolkit-trace-context-activation</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>skywalking-toolkit-activation</artifactId>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class Log4j2OutputAppenderActivation extends ClassStaticMethodsEnhancePlu
|
|||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return "com.a.eye.skywalking.toolkit.log.log4j.v2.x.PrintTraceIdInterceptor";
|
||||
return "com.a.eye.skywalking.toolkit.activation.log.log4j.v2.x.PrintTraceIdInterceptor";
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<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-application-toolkit</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>2.0-2016</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-toolkit-trace-context-activation</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>skywalking-toolkit-trace-context-activation</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.a.eye.skywalking.toolkit.activation.trace;
|
||||
|
||||
import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.MethodMatcher;
|
||||
import com.a.eye.skywalking.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
|
||||
import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/12/15.
|
||||
*/
|
||||
public class TraceContextActivation extends ClassStaticMethodsEnhancePluginDefine {
|
||||
@Override
|
||||
protected String enhanceClassName() {
|
||||
return "com.a.eye.skywalking.toolkit.trace.TraceContext";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[]{
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override
|
||||
public MethodMatcher[] getMethodsMatchers() {
|
||||
return new MethodMatcher[]{
|
||||
new SimpleMethodMatcher("traceId")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return "com.a.eye.skywalking.toolkit.activation.trace.TraceContextInterceptor";
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.a.eye.skywalking.toolkit.activation.trace;
|
||||
|
||||
import com.a.eye.skywalking.api.Tracing;
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.StaticMethodInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/12/15.
|
||||
*/
|
||||
public class TraceContextInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
private ILog logger = LogManager.getLogger(TraceContextInterceptor.class);
|
||||
|
||||
@Override
|
||||
public void beforeMethod(StaticMethodInvokeContext interceptorContext, MethodInterceptResult result) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(StaticMethodInvokeContext interceptorContext, Object ret) {
|
||||
return Tracing.getTraceId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t, MethodInvokeContext interceptorContext) {
|
||||
logger.error("Failed to get trace Id.", t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
com.a.eye.skywalking.toolkit.activation.trace.TraceContextActivation
|
||||
|
|
@ -15,7 +15,7 @@ public class ElasticBootstrapTest {
|
|||
@Test
|
||||
public void fetchElasticHomeWithoutProperty() {
|
||||
ElasticBootstrap booter = new ElasticBootstrap();
|
||||
assertEquals("Elastic Home :", booter.fetchElasticHome(), bastPath + "install/data/index");
|
||||
assertEquals("Elastic Home :", booter.fetchElasticHome(), bastPath + "skywalking-storage/data/index");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue