提交 2c3e3ce3 编写于 作者: A ascrutae

修复部分问题

上级 e04fbee8
......@@ -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>
<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>
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";
}
}};
}
......
<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>
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";
}
}
};
}
}
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);
}
}
com.a.eye.skywalking.toolkit.activation.trace.TraceContextActivation
\ No newline at end of file
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册