提交 7ac504b1 编写于 作者: P pengys5

Merge commit 'c3259afa' into feature/160

# Conflicts:
#	apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
#	apm-sniffer/apm-agent/pom.xml
#	apm-sniffer/apm-sdk-plugin/pom.xml
...@@ -10,6 +10,7 @@ install: ...@@ -10,6 +10,7 @@ install:
- mvn install:install-file -Dfile=jmxri-1.2.1.jar -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar - mvn install:install-file -Dfile=jmxri-1.2.1.jar -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar
- mvn install:install-file -Dfile=dubbox-2.8.4.jar -DgroupId=com.alibaba -DartifactId=dubbox -Dversion=2.8.4 -Dpackaging=jar - mvn install:install-file -Dfile=dubbox-2.8.4.jar -DgroupId=com.alibaba -DartifactId=dubbox -Dversion=2.8.4 -Dpackaging=jar
- mvn install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar - mvn install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar
- mvn install:install-file -Dfile=resin-4.0.41.jar -DgroupId=com.caucho -DartifactId=resin -Dversion=4.0.41 -Dpackaging=jar
- cd .. - cd ..
script: script:
......
...@@ -33,13 +33,13 @@ ___ ...@@ -33,13 +33,13 @@ ___
# Contributors # Contributors
_In chronological order_ _In chronological order_
* 吴晟 [@wu-sheng](https://github.com/wu-sheng) * 吴晟 [@wu-sheng](https://github.com/wu-sheng) Principle Engineer, 2012 Lab, Huawei.
* 张鑫 [@ascrutae](https://github.com/ascrutae) * 张鑫 [@ascrutae](https://github.com/ascrutae)
* 谭真 [@mircoteam](https://github.com/mircoteam) * 谭真 [@mircoteam](https://github.com/mircoteam) Advanced R&D Engineers, Creative & Interactive Group.
* 徐妍 [@TastySummer](https://github.com/TastySummer) * 徐妍 [@TastySummer](https://github.com/TastySummer)
* 彭勇升 [@pengys5](https://github.com/pengys5) * 彭勇升 [@pengys5](https://github.com/pengys5) Technical Specialist, OneAPM.
* 戴文 * 戴文
* 柏杨 [@bai-yang](https://github.com/bai-yang) * 柏杨 [@bai-yang](https://github.com/bai-yang) Senior Engineer, Alibaba Group.
# Screenshots # Screenshots
- Topological graph of application clusters. - Topological graph of application clusters.
......
...@@ -3,6 +3,7 @@ package org.skywalking.apm.util; ...@@ -3,6 +3,7 @@ package org.skywalking.apm.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -20,7 +21,7 @@ public class ConfigInitializer { ...@@ -20,7 +21,7 @@ public class ConfigInitializer {
} }
private static void initNextLevel(Properties properties, Class<?> recentConfigType, private static void initNextLevel(Properties properties, Class<?> recentConfigType,
ConfigDesc parentDesc) throws IllegalArgumentException, IllegalAccessException { ConfigDesc parentDesc) throws IllegalArgumentException, IllegalAccessException {
for (Field field : recentConfigType.getFields()) { for (Field field : recentConfigType.getFields()) {
if (Modifier.isPublic(field.getModifiers()) && Modifier.isStatic(field.getModifiers())) { if (Modifier.isPublic(field.getModifiers()) && Modifier.isStatic(field.getModifiers())) {
String configKey = (parentDesc + "." + field.getName()).toLowerCase(); String configKey = (parentDesc + "." + field.getName()).toLowerCase();
...@@ -35,8 +36,10 @@ public class ConfigInitializer { ...@@ -35,8 +36,10 @@ public class ConfigInitializer {
field.set(null, Long.valueOf(value)); field.set(null, Long.valueOf(value));
else if (type.equals(boolean.class)) else if (type.equals(boolean.class))
field.set(null, Boolean.valueOf(value)); field.set(null, Boolean.valueOf(value));
else if (type.equals(List.class))
field.set(null, convert2List(value));
else if (type.isEnum()) else if (type.isEnum())
field.set(null, Enum.valueOf((Class<Enum>) type, value.toUpperCase())); field.set(null, Enum.valueOf((Class<Enum>)type, value.toUpperCase()));
} }
} }
} }
...@@ -46,6 +49,22 @@ public class ConfigInitializer { ...@@ -46,6 +49,22 @@ public class ConfigInitializer {
parentDesc.removeLastDesc(); parentDesc.removeLastDesc();
} }
} }
private static List convert2List(String value) {
List result = new LinkedList();
if (StringUtil.isEmpty(value)) {
return result;
}
String[] segments = value.split(",");
for (String segment : segments) {
String trimmedSegment = segment.trim();
if (!StringUtil.isEmpty(trimmedSegment)) {
result.add(trimmedSegment);
}
}
return result;
}
} }
class ConfigDesc { class ConfigDesc {
......
package org.skywalking.apm.agent.core.conf; package org.skywalking.apm.agent.core.conf;
import java.util.LinkedList;
import java.util.List;
import org.skywalking.apm.agent.core.logging.LogLevel; import org.skywalking.apm.agent.core.logging.LogLevel;
import org.skywalking.apm.agent.core.logging.WriterFactory; import org.skywalking.apm.agent.core.logging.WriterFactory;
...@@ -83,6 +85,16 @@ public class Config { ...@@ -83,6 +85,16 @@ public class Config {
} }
public static class Plugin { public static class Plugin {
/**
* Name of disabled plugin, The value spilt by <code>,</code>
* if you have multiple plugins need to disable.
*
* Here are the plugin names :
* tomcat-7.x/8.x, dubbo, jedis-2.x, motan, httpclient-4.x, jdbc, mongodb-3.x.
*/
public static List DISABLED_PLUGINS = new LinkedList();
public static class MongoDB { public static class MongoDB {
/** /**
* If true, trace all the parameters, default is false. * If true, trace all the parameters, default is false.
......
...@@ -24,7 +24,7 @@ public abstract class AbstractClassEnhancePluginDefine { ...@@ -24,7 +24,7 @@ public abstract class AbstractClassEnhancePluginDefine {
* *
* @param transformClassName target class. * @param transformClassName target class.
* @param builder byte-buddy's builder to manipulate target class's bytecode. * @param builder byte-buddy's builder to manipulate target class's bytecode.
* @return be defined builder. * @return the new builder, or <code>null</code> if not be enhanced.
* @throws PluginException, when set builder failure. * @throws PluginException, when set builder failure.
*/ */
public DynamicType.Builder<?> define(String transformClassName, public DynamicType.Builder<?> define(String transformClassName,
...@@ -33,7 +33,7 @@ public abstract class AbstractClassEnhancePluginDefine { ...@@ -33,7 +33,7 @@ public abstract class AbstractClassEnhancePluginDefine {
if (StringUtil.isEmpty(transformClassName)) { if (StringUtil.isEmpty(transformClassName)) {
logger.warn("classname of being intercepted is not defined by {}.", interceptorDefineClassName); logger.warn("classname of being intercepted is not defined by {}.", interceptorDefineClassName);
return builder; return null;
} }
logger.debug("prepare to enhance class {} by {}.", transformClassName, interceptorDefineClassName); logger.debug("prepare to enhance class {} by {}.", transformClassName, interceptorDefineClassName);
...@@ -48,7 +48,7 @@ public abstract class AbstractClassEnhancePluginDefine { ...@@ -48,7 +48,7 @@ public abstract class AbstractClassEnhancePluginDefine {
if (!witnessClassResolution.isResolved()) { if (!witnessClassResolution.isResolved()) {
logger.warn("enhance class {} by plugin {} is not working. Because witness class {} is not existed.", transformClassName, interceptorDefineClassName, logger.warn("enhance class {} by plugin {} is not working. Because witness class {} is not existed.", transformClassName, interceptorDefineClassName,
witnessClass); witnessClass);
return builder; return null;
} }
} }
} }
......
...@@ -42,18 +42,18 @@ public class PluginBootstrap { ...@@ -42,18 +42,18 @@ public class PluginBootstrap {
} }
} }
List<String> pluginClassList = PluginCfg.INSTANCE.getPluginClassList(); List<PluginDefine> pluginClassList = PluginCfg.INSTANCE.getPluginClassList();
List<AbstractClassEnhancePluginDefine> plugins = new ArrayList<AbstractClassEnhancePluginDefine>(); List<AbstractClassEnhancePluginDefine> plugins = new ArrayList<AbstractClassEnhancePluginDefine>();
for (String pluginClassName : pluginClassList) { for (PluginDefine pluginDefine : pluginClassList) {
try { try {
logger.debug("loading plugin class {}.", pluginClassName); logger.debug("loading plugin class {}.", pluginDefine.getDefineClass());
AbstractClassEnhancePluginDefine plugin = AbstractClassEnhancePluginDefine plugin =
(AbstractClassEnhancePluginDefine) Class.forName(pluginClassName).newInstance(); (AbstractClassEnhancePluginDefine) Class.forName(pluginDefine.getDefineClass()).newInstance();
plugin.setClassTypePool(classTypePool); plugin.setClassTypePool(classTypePool);
plugins.add(plugin); plugins.add(plugin);
} catch (Throwable t) { } catch (Throwable t) {
logger.error(t, "loade plugin [{}] failure.", pluginClassName); logger.error(t, "load plugin [{}] failure.", pluginDefine.getDefineClass());
} }
} }
......
package org.skywalking.apm.agent.core.plugin; package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.util.StringUtil;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.skywalking.apm.agent.core.plugin.exception.IllegalPluginDefineException;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
public enum PluginCfg { public enum PluginCfg {
INSTANCE; INSTANCE;
private List<String> pluginClassList = new ArrayList<String>(); private static final ILog logger = LogManager.getLogger(PluginCfg.class);
private List<PluginDefine> pluginClassList = new ArrayList<PluginDefine>();
void load(InputStream input) throws IOException { void load(InputStream input) throws IOException {
try { try {
BufferedReader reader = new BufferedReader(new InputStreamReader(input)); BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String pluginDefineClassName = null; String pluginDefine = null;
while ((pluginDefineClassName = reader.readLine()) != null) { while ((pluginDefine = reader.readLine()) != null) {
if (!StringUtil.isEmpty(pluginDefineClassName)) { try {
pluginClassList.add(pluginDefineClassName.trim()); PluginDefine plugin = PluginDefine.build(pluginDefine);
if (plugin.enable()) {
pluginClassList.add(plugin);
}
} catch (IllegalPluginDefineException e) {
logger.error("Failed to format plugin define.", e);
} }
} }
} finally { } finally {
...@@ -28,7 +36,8 @@ public enum PluginCfg { ...@@ -28,7 +36,8 @@ public enum PluginCfg {
} }
} }
public List<String> getPluginClassList() { public List<PluginDefine> getPluginClassList() {
return pluginClassList; return pluginClassList;
} }
} }
package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.plugin.exception.IllegalPluginDefineException;
import org.skywalking.apm.util.StringUtil;
public class PluginDefine {
/**
* Plugin name.
*/
private String name;
/**
* The class name of plugin defined.
*/
private String defineClass;
private PluginDefine(String name, String defineClass) {
this.name = name;
this.defineClass = defineClass;
}
public static PluginDefine build(String define) throws IllegalPluginDefineException {
if (StringUtil.isEmpty(define)) {
throw new IllegalPluginDefineException(define);
}
String[] pluginDefine = define.split("=");
if (pluginDefine.length != 2) {
throw new IllegalPluginDefineException(define);
}
return new PluginDefine(pluginDefine[0], pluginDefine[1]);
}
public boolean enable() {
return !Config.Plugin.DISABLED_PLUGINS.contains(name);
}
public String getDefineClass() {
return defineClass;
}
}
package org.skywalking.apm.agent.core.plugin; package org.skywalking.apm.agent.core.plugin;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,7 +12,7 @@ import java.util.Map; ...@@ -11,7 +12,7 @@ import java.util.Map;
* @author wusheng * @author wusheng
*/ */
public class PluginFinder { public class PluginFinder {
private final Map<String, AbstractClassEnhancePluginDefine> pluginDefineMap = new HashMap<String, AbstractClassEnhancePluginDefine>(); private final Map<String, LinkedList<AbstractClassEnhancePluginDefine>> pluginDefineMap = new HashMap<String, LinkedList<AbstractClassEnhancePluginDefine>>();
public PluginFinder(List<AbstractClassEnhancePluginDefine> plugins) { public PluginFinder(List<AbstractClassEnhancePluginDefine> plugins) {
for (AbstractClassEnhancePluginDefine plugin : plugins) { for (AbstractClassEnhancePluginDefine plugin : plugins) {
...@@ -21,11 +22,17 @@ public class PluginFinder { ...@@ -21,11 +22,17 @@ public class PluginFinder {
continue; continue;
} }
pluginDefineMap.put(enhanceClassName, plugin); LinkedList<AbstractClassEnhancePluginDefine> pluginDefinesWithSameTarget = pluginDefineMap.get(enhanceClassName);
if (pluginDefinesWithSameTarget == null) {
pluginDefinesWithSameTarget = new LinkedList<AbstractClassEnhancePluginDefine>();
pluginDefineMap.put(enhanceClassName, pluginDefinesWithSameTarget);
}
pluginDefinesWithSameTarget.add(plugin);
} }
} }
public AbstractClassEnhancePluginDefine find(String enhanceClassName) { public List<AbstractClassEnhancePluginDefine> find(String enhanceClassName) {
if (pluginDefineMap.containsKey(enhanceClassName)) { if (pluginDefineMap.containsKey(enhanceClassName)) {
return pluginDefineMap.get(enhanceClassName); return pluginDefineMap.get(enhanceClassName);
} }
......
package org.skywalking.apm.agent.core.plugin.exception;
/**
* Thrown to indicate that a illegal format plugin definition has been defined in skywalking-plugin.define.
*/
public class IllegalPluginDefineException extends Exception {
public IllegalPluginDefineException(String define) {
super("Illegal plugin define : " + define);
}
}
org.skywalking.apm.agent.core.queue.TraceSegmentProcessQueue org.skywalking.apm.agent.core.queue.TraceSegmentProcessQueue
org.skywalking.apm.agent.core.context.ContextManager org.skywalking.apm.agent.core.context.ContextManager
org.skywalking.apm.agent.core.client.CollectorClientService org.skywalking.apm.agent.core.client.CollectorClientService
org.skywalking.apm.agent.core.sampling.SamplingService org.skywalking.apm.agent.core.sampling.SamplingService
\ No newline at end of file
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
public class PluginCfgTest { public class PluginCfgTest {
@Test @Test
public void testLoad() throws IOException { public void testLoad() throws IOException {
String data = "com.test.classA\r\ncom.test.ClassB"; String data = "TestA=com.test.classA\r\nTestB=com.test.ClassB";
final byte[] dataBytes = data.getBytes(); final byte[] dataBytes = data.getBytes();
PluginCfg.INSTANCE.load(new InputStream() { PluginCfg.INSTANCE.load(new InputStream() {
int index = 0; int index = 0;
...@@ -31,10 +31,10 @@ public class PluginCfgTest { ...@@ -31,10 +31,10 @@ public class PluginCfgTest {
} }
}); });
List<String> list = PluginCfg.INSTANCE.getPluginClassList(); List<PluginDefine> list = PluginCfg.INSTANCE.getPluginClassList();
Assert.assertEquals(2, list.size()); Assert.assertEquals(2, list.size());
Assert.assertEquals("com.test.classA", list.get(0)); Assert.assertEquals("com.test.classA", list.get(0).getDefineClass());
Assert.assertEquals("com.test.ClassB", list.get(1)); Assert.assertEquals("com.test.ClassB", list.get(1).getDefineClass());
} }
@Before @Before
......
org.skywalking.apm.agent.core.plugin.MockAbstractClassEnhancePluginDefine MOCKPLUGIN=org.skywalking.apm.agent.core.plugin.MockAbstractClassEnhancePluginDefine
...@@ -60,6 +60,16 @@ ...@@ -60,6 +60,16 @@
<artifactId>apm-mongodb-3.x-plugin</artifactId> <artifactId>apm-mongodb-3.x-plugin</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.skywalking</groupId>
<artifactId>apm-resin-3.x-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.skywalking</groupId>
<artifactId>apm-resin-4.x-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.skywalking</groupId> <groupId>org.skywalking</groupId>
<artifactId>apm-okhttp-3.x-plugin</artifactId> <artifactId>apm-okhttp-3.x-plugin</artifactId>
......
package org.skywalking.apm.agent; package org.skywalking.apm.agent;
import java.util.List;
import net.bytebuddy.agent.builder.AgentBuilder; import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.NamedElement; import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.description.type.TypeDescription;
...@@ -53,14 +54,22 @@ public class SkyWalkingAgent { ...@@ -53,14 +54,22 @@ public class SkyWalkingAgent {
new AgentBuilder.Default().type(enhanceClassMatcher(pluginFinder).and(not(isInterface()))).transform(new AgentBuilder.Transformer() { new AgentBuilder.Default().type(enhanceClassMatcher(pluginFinder).and(not(isInterface()))).transform(new AgentBuilder.Transformer() {
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription, public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription,
ClassLoader classLoader) { ClassLoader classLoader) {
AbstractClassEnhancePluginDefine pluginDefine = pluginFinder.find(typeDescription.getTypeName()); List<AbstractClassEnhancePluginDefine> pluginDefines = pluginFinder.find(typeDescription.getTypeName());
return pluginDefine.define(typeDescription.getTypeName(), builder); for (AbstractClassEnhancePluginDefine pluginDefine : pluginDefines) {
DynamicType.Builder<?> newBuilder = pluginDefine.define(typeDescription.getTypeName(), builder);
if (newBuilder != null) {
return newBuilder;
}
}
logger.warn("Matched class {}, but enhancement fail.", typeDescription.getTypeName());
return builder;
} }
}).with(new AgentBuilder.Listener() { }).with(new AgentBuilder.Listener() {
@Override @Override
public void onTransformation(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module, public void onTransformation(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module,
DynamicType dynamicType) { DynamicType dynamicType) {
} }
......
org.skywalking.apm.plugin.dubbo.DubboInstrumentation dubbo=org.skywalking.apm.plugin.dubbo.DubboInstrumentation
\ No newline at end of file
org.skywalking.apm.plugin.okhttp.v3.define.RealCallInstrumentation okhttp-3.x=org.skywalking.apm.plugin.okhttp.v3.define.RealCallInstrumentation
\ No newline at end of file \ No newline at end of file
org.skywalking.apm.plugin.httpClient.v4.define.AbstractHttpClientInstrumentation httpclient-4.x=org.skywalking.apm.plugin.httpClient.v4.define.AbstractHttpClientInstrumentation
org.skywalking.apm.plugin.httpClient.v4.define.InternalHttpClientInstrumentation httpclient-4.x=org.skywalking.apm.plugin.httpClient.v4.define.InternalHttpClientInstrumentation
org.skywalking.apm.plugin.httpClient.v4.define.MinimalHttpClientInstrumentation httpclient-4.x=org.skywalking.apm.plugin.httpClient.v4.define.MinimalHttpClientInstrumentation
org.skywalking.apm.plugin.httpClient.v4.define.DefaultRequestDirectorInstrumentation httpclient-4.x=org.skywalking.apm.plugin.httpClient.v4.define.DefaultRequestDirectorInstrumentation
\ No newline at end of file
org.skywalking.apm.plugin.jdbc.define.H2Instrumentation jdbc=org.skywalking.apm.plugin.jdbc.define.H2Instrumentation
org.skywalking.apm.plugin.jdbc.define.MysqlInstrumentation jdbc=org.skywalking.apm.plugin.jdbc.define.MysqlInstrumentation
org.skywalking.apm.plugin.jdbc.define.OracleInstrumentation jdbc=org.skywalking.apm.plugin.jdbc.define.OracleInstrumentation
\ No newline at end of file
org.skywalking.apm.plugin.jedis.v2.define.JedisClusterInstrumentation jedis-2.x=org.skywalking.apm.plugin.jedis.v2.define.JedisClusterInstrumentation
org.skywalking.apm.plugin.jedis.v2.define.JedisInstrumentation jedis-2.x=org.skywalking.apm.plugin.jedis.v2.define.JedisInstrumentation
\ No newline at end of file
org.skywalking.apm.plugin.mongodb.v3.define.MongoDBInstrumentation mongodb-3.x=org.skywalking.apm.plugin.mongodb.v3.define.MongoDBInstrumentation
\ No newline at end of file \ No newline at end of file
org.skywalking.apm.plugin.motan.define.MotanConsumerInstrumentation motan-0.x=org.skywalking.apm.plugin.motan.define.MotanConsumerInstrumentation
org.skywalking.apm.plugin.motan.define.MotanProviderInstrumentation motan-0.x=org.skywalking.apm.plugin.motan.define.MotanProviderInstrumentation
\ No newline at end of file
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<module>motan-plugin</module> <module>motan-plugin</module>
<module>mongodb-3.x-plugin</module> <module>mongodb-3.x-plugin</module>
<module>http-plugin</module> <module>http-plugin</module>
<module>resin-3.x-plugin</module>
<module>resin-4.x-plugin</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
......
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>apm-sdk-plugin</artifactId>
<groupId>org.skywalking</groupId>
<version>3.1-2017</version>
</parent>
<artifactId>apm-resin-3.x-plugin</artifactId>
<packaging>jar</packaging>
<name>resin-3.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin</artifactId>
<version>3.0.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- 源码插件 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<!-- 发布时自动将源码同时发布的配置 -->
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package org.skywalking.apm.plugin.resin.v3;
import com.caucho.server.connection.CauchoRequest;
import com.caucho.server.http.HttpRequest;
import com.caucho.server.http.HttpResponse;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.tag.Tags;
import org.skywalking.apm.util.StringUtil;
/**
* {@link ResinV3Interceptor} intercept method of{@link com.caucho.server.dispatch.ServletInvocation#service(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse)} record the resin host, port ,url.
*
* @author baiyang
*/
public class ResinV3Interceptor implements InstanceMethodsAroundInterceptor {
/**
* Header name that the serialized context data stored in
* {@link HttpRequest#getHeader(String)}.
*/
public static final String HEADER_NAME_OF_CONTEXT_DATA = "SWTraceContext";
/**
* Resin component.
*/
public static final String RESIN_COMPONENT = "Resin";
@Override
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
MethodInterceptResult result) {
Object[] args = interceptorContext.allArguments();
CauchoRequest request = (CauchoRequest)args[0];
Span span = ContextManager.createSpan(request.getPageURI());
Tags.COMPONENT.set(span, RESIN_COMPONENT);
Tags.PEER_HOST.set(span, request.getServerName());
Tags.PEER_PORT.set(span, request.getServerPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.URL.set(span, appendRequestURL(request));
Tags.SPAN_LAYER.asHttp(span);
String tracingHeaderValue = request.getHeader(HEADER_NAME_OF_CONTEXT_DATA);
if (!StringUtil.isEmpty(tracingHeaderValue)) {
ContextManager.extract(new ContextCarrier().deserialize(tracingHeaderValue));
}
}
/**
* Append request URL.
*
* @param request
* @return
*/
private String appendRequestURL(CauchoRequest request) {
StringBuffer sb = new StringBuffer();
sb.append(request.getScheme());
sb.append("://");
sb.append(request.getServerName());
sb.append(":");
sb.append(request.getServerPort());
sb.append(request.getPageURI());
return sb.toString();
}
@Override
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
Object ret) {
HttpResponse response = (HttpResponse)interceptorContext.allArguments()[1];
Span span = ContextManager.activeSpan();
Tags.STATUS_CODE.set(span, response.getStatusCode());
if (response.getStatusCode() != 200) {
Tags.ERROR.set(span, true);
}
ContextManager.stopSpan();
return ret;
}
@Override
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
InstanceMethodInvokeContext interceptorContext) {
Span span = ContextManager.activeSpan();
span.log(t);
Tags.ERROR.set(span, true);
}
}
package org.skywalking.apm.plugin.resin.v3.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.skywalking.apm.plugin.resin.v3.ResinV3Interceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link ResinV3Instrumentation} presents that skywalking intercepts {@link com.caucho.server.dispatch.ServletInvocation#service(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse)} by using {@link ResinV3Interceptor}.
*
* @author baiyang
*/
public class ResinV3Instrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "com.caucho.server.dispatch.ServletInvocation";
private static final String METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.resin.v3.ResinV3Interceptor";
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return null;
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[] {
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("service");
}
@Override
public String getMethodsInterceptor() {
return METHOD_INTERCET_CLASS;
}
}
};
}
@Override
protected String enhanceClassName() {
return ENHANCE_CLASS;
}
@Override
protected String[] witnessClasses() {
return new String[] {"com.caucho.server.connection.AbstractHttpResponse"};
}
}
resin-3.x=org.skywalking.apm.plugin.resin.v3.define.ResinV3Instrumentation
\ No newline at end of file
package org.skywalking.apm.plugin.resin.v3;
import com.caucho.server.connection.CauchoRequest;
import com.caucho.server.http.HttpResponse;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.context.TracerContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.sniffer.mock.context.MockTracerContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.trace.LogData;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment;
import org.skywalking.apm.trace.TraceSegmentRef;
import org.skywalking.apm.trace.tag.Tags;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
/**
* ResinInterceptorTest
*
* @author baiyang
*/
@RunWith(MockitoJUnitRunner.class)
public class ResinV3InterceptorTest {
private ResinV3Interceptor interceptor;
private MockTracerContextListener contextListener;
@Mock
private CauchoRequest request;
@Mock
private HttpResponse response;
@Mock
private EnhancedClassInstanceContext classInstanceContext;
@Mock
private InstanceMethodInvokeContext methodInvokeContext;
@Mock
private MethodInterceptResult methodInterceptResult;
@Before
public void setUp() throws Exception {
ServiceManager.INSTANCE.boot();
interceptor = new ResinV3Interceptor();
contextListener = new MockTracerContextListener();
TracerContext.ListenerManager.add(contextListener);
when(request.getPageURI()).thenReturn("/test/testRequestURL");
when(request.getScheme()).thenReturn("http");
when(request.getServerName()).thenReturn("localhost");
when(request.getServerPort()).thenReturn(8080);
when(request.getRequestURL()).thenReturn(new StringBuffer("http://localhost:8080/test/testRequestURL"));
when(response.getStatusCode()).thenReturn(200);
when(methodInvokeContext.allArguments()).thenReturn(new Object[] {request, response});
}
@Test
public void testWithoutSerializedContextData() {
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
}
});
}
@Test
public void testWithSerializedContextData() {
when(request.getHeader(ResinV3Interceptor.HEADER_NAME_OF_CONTEXT_DATA)).thenReturn("302017.1487666919810.624424584.17332.1.1|1|REMOTE_APP|127.0.0.1|Trace.globalId.123|1");
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
assertTraceSegmentRef(traceSegment.getRefs().get(0));
}
});
}
@Test
public void testWithOccurException() {
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.handleMethodException(new RuntimeException(), classInstanceContext, methodInvokeContext);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
assertThat(span.getLogs().size(), is(1));
assertSpanLog(span.getLogs().get(0));
}
});
}
private void assertSpanLog(LogData logData) {
assertThat(logData.getFields().size(), is(4));
assertThat(logData.getFields().get("event"), CoreMatchers.<Object>is("error"));
assertThat(logData.getFields().get("error.kind"), CoreMatchers.<Object>is(RuntimeException.class.getName()));
assertNull(logData.getFields().get("message"));
}
private void assertTraceSegmentRef(TraceSegmentRef ref) {
assertThat(ref.getSpanId(), is(1));
assertThat(ref.getTraceSegmentId(), is("302017.1487666919810.624424584.17332.1.1"));
}
private void assertHttpSpan(Span span) {
assertThat(span.getOperationName(), is("/test/testRequestURL"));
assertThat(Tags.COMPONENT.get(span), is("Resin"));
assertThat(Tags.URL.get(span), is("http://localhost:8080/test/testRequestURL"));
assertThat(Tags.STATUS_CODE.get(span), is(200));
assertThat(Tags.SPAN_KIND.get(span), is(Tags.SPAN_KIND_SERVER));
assertTrue(Tags.SPAN_LAYER.isHttp(span));
}
@After
public void tearDown() throws Exception {
TracerContext.ListenerManager.remove(new MockTracerContextListener());
}
}
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>apm-sdk-plugin</artifactId>
<groupId>org.skywalking</groupId>
<version>3.1-2017</version>
</parent>
<artifactId>apm-resin-4.x-plugin</artifactId>
<packaging>jar</packaging>
<name>resin-4.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin</artifactId>
<version>4.0.41</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- 源码插件 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<!-- 发布时自动将源码同时发布的配置 -->
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package org.skywalking.apm.plugin.resin.v4;
import com.caucho.server.http.CauchoRequest;
import com.caucho.server.http.HttpRequest;
import javax.servlet.http.HttpServletResponse;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.tag.Tags;
import org.skywalking.apm.util.StringUtil;
/**
* Created by Baiyang on 2017/5/2.
*/
public class ResinV4Interceptor implements InstanceMethodsAroundInterceptor {
/**
* Header name that the serialized context data stored in
* {@link HttpRequest#getHeader(String)}.
*/
public static final String HEADER_NAME_OF_CONTEXT_DATA = "SWTraceContext";
/**
* Resin component.
*/
public static final String RESIN_COMPONENT = "Resin";
@Override
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
MethodInterceptResult result) {
Object[] args = interceptorContext.allArguments();
CauchoRequest request = (CauchoRequest)args[0];
Span span = ContextManager.createSpan(request.getPageURI());
Tags.COMPONENT.set(span, RESIN_COMPONENT);
Tags.PEER_HOST.set(span, request.getServerName());
Tags.PEER_PORT.set(span, request.getServerPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.URL.set(span, appendRequestURL(request));
Tags.SPAN_LAYER.asHttp(span);
String tracingHeaderValue = request.getHeader(HEADER_NAME_OF_CONTEXT_DATA);
if (!StringUtil.isEmpty(tracingHeaderValue)) {
ContextManager.extract(new ContextCarrier().deserialize(tracingHeaderValue));
}
}
/**
* Append request URL.
*
* @param request
* @return
*/
private String appendRequestURL(CauchoRequest request) {
StringBuffer sb = new StringBuffer();
sb.append(request.getScheme());
sb.append("://");
sb.append(request.getServerName());
sb.append(":");
sb.append(request.getServerPort());
sb.append(request.getPageURI());
return sb.toString();
}
@Override
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
Object ret) {
HttpServletResponse response = (HttpServletResponse)interceptorContext.allArguments()[1];
Span span = ContextManager.activeSpan();
Tags.STATUS_CODE.set(span, response.getStatus());
if (response.getStatus() != 200) {
Tags.ERROR.set(span, true);
}
ContextManager.stopSpan();
return ret;
}
@Override
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
InstanceMethodInvokeContext interceptorContext) {
Span span = ContextManager.activeSpan();
span.log(t);
Tags.ERROR.set(span, true);
}
}
package org.skywalking.apm.plugin.resin.v4.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.skywalking.apm.plugin.resin.v4.ResinV4Interceptor;
import static net.bytebuddy.matcher.ElementMatchers.named;
/**
* {@link ResinV4Instrumentation} presents that skywalking intercepts {@link com.caucho.server.dispatch.ServletInvocation#service(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse)} by using {@link ResinV4Interceptor}.
*
* @author baiyang
*/
public class ResinV4Instrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "com.caucho.server.dispatch.ServletInvocation";
private static final String METHOD_INTERCET_CLASS = "org.skywalking.apm.plugin.resin.v4.ResinV4Interceptor";
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return null;
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[] {
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("service");
}
@Override
public String getMethodsInterceptor() {
return METHOD_INTERCET_CLASS;
}
}
};
}
@Override
protected String enhanceClassName() {
return ENHANCE_CLASS;
}
@Override
protected String[] witnessClasses() {
return new String[] {"com.caucho.server.http.HttpServletResponseImpl"};
}
}
resin-4.x=org.skywalking.apm.plugin.resin.v4.define.ResinV4Instrumentation
\ No newline at end of file
package org.skywalking.apm.plugin.resin.v4;
import com.caucho.server.http.CauchoRequest;
import javax.servlet.http.HttpServletResponse;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.context.TracerContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.sniffer.mock.context.MockTracerContextListener;
import org.skywalking.apm.sniffer.mock.context.SegmentAssert;
import org.skywalking.apm.trace.LogData;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment;
import org.skywalking.apm.trace.TraceSegmentRef;
import org.skywalking.apm.trace.tag.Tags;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
/**
* Created by Baiyang on 2017/5/6.
*/
@RunWith(MockitoJUnitRunner.class)
public class ResinV4InterceptorTest {
private ResinV4Interceptor interceptor;
private MockTracerContextListener contextListener;
@Mock
private CauchoRequest request;
@Mock
private HttpServletResponse response;
@Mock
private EnhancedClassInstanceContext classInstanceContext;
@Mock
private InstanceMethodInvokeContext methodInvokeContext;
@Mock
private MethodInterceptResult methodInterceptResult;
@Before
public void setUp() throws Exception {
ServiceManager.INSTANCE.boot();
interceptor = new ResinV4Interceptor();
contextListener = new MockTracerContextListener();
TracerContext.ListenerManager.add(contextListener);
when(request.getPageURI()).thenReturn("/test/testRequestURL");
when(request.getScheme()).thenReturn("http");
when(request.getServerName()).thenReturn("localhost");
when(request.getServerPort()).thenReturn(8080);
when(request.getRequestURI()).thenReturn("/test/testRequestURL");
when(request.getRequestURL()).thenReturn(new StringBuffer("http://localhost:8080/test/testRequestURL"));
when(response.getStatus()).thenReturn(200);
when(methodInvokeContext.allArguments()).thenReturn(new Object[] {request, response});
}
@Test
public void testWithoutSerializedContextData() {
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
}
});
}
@Test
public void testWithSerializedContextData() {
when(request.getHeader(ResinV4Interceptor.HEADER_NAME_OF_CONTEXT_DATA)).thenReturn("302017.1487666919810.624424584.17332.1.1|1|REMOTE_APP|127.0.0.1|Trace.globalId.123|1");
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
assertTraceSegmentRef(traceSegment.getRefs().get(0));
}
});
}
@Test
public void testWithOccurException() {
interceptor.beforeMethod(classInstanceContext, methodInvokeContext, methodInterceptResult);
interceptor.handleMethodException(new RuntimeException(), classInstanceContext, methodInvokeContext);
interceptor.afterMethod(classInstanceContext, methodInvokeContext, null);
contextListener.assertSize(1);
contextListener.assertTraceSegment(0, new SegmentAssert() {
@Override
public void call(TraceSegment traceSegment) {
assertThat(traceSegment.getSpans().size(), is(1));
Span span = traceSegment.getSpans().get(0);
assertHttpSpan(span);
assertThat(span.getLogs().size(), is(1));
assertSpanLog(span.getLogs().get(0));
}
});
}
private void assertSpanLog(LogData logData) {
assertThat(logData.getFields().size(), is(4));
assertThat(logData.getFields().get("event"), CoreMatchers.<Object>is("error"));
assertThat(logData.getFields().get("error.kind"), CoreMatchers.<Object>is(RuntimeException.class.getName()));
assertNull(logData.getFields().get("message"));
}
private void assertTraceSegmentRef(TraceSegmentRef ref) {
assertThat(ref.getSpanId(), is(1));
assertThat(ref.getTraceSegmentId(), is("302017.1487666919810.624424584.17332.1.1"));
}
private void assertHttpSpan(Span span) {
assertThat(span.getOperationName(), is("/test/testRequestURL"));
assertThat(Tags.COMPONENT.get(span), is("Resin"));
assertThat(Tags.URL.get(span), is("http://localhost:8080/test/testRequestURL"));
assertThat(Tags.STATUS_CODE.get(span), is(200));
assertThat(Tags.SPAN_KIND.get(span), is(Tags.SPAN_KIND_SERVER));
assertTrue(Tags.SPAN_LAYER.isHttp(span));
}
@After
public void tearDown() throws Exception {
TracerContext.ListenerManager.remove(new MockTracerContextListener());
}
}
org.skywalking.apm.plugin.tomcat78x.define.TomcatInstrumentation tomcat-7.x/8.x=org.skywalking.apm.plugin.tomcat78x.define.TomcatInstrumentation
\ No newline at end of file
org.skywalking.apm.toolkit.activation.log.log4j.v1.x.TraceIdPatternConverterActivation log4j=org.skywalking.apm.toolkit.activation.log.log4j.v1.x.TraceIdPatternConverterActivation
\ No newline at end of file
org.skywalking.apm.toolkit.activation.log.log4j.v2.x.Log4j2OutputAppenderActivation log4j2=org.skywalking.apm.toolkit.activation.log.log4j.v2.x.Log4j2OutputAppenderActivation
\ No newline at end of file
org.skywalking.apm.toolkit.activation.log.logback.v1.x.LogbackPatternConverterActivation logback=org.skywalking.apm.toolkit.activation.log.logback.v1.x.LogbackPatternConverterActivation
\ No newline at end of file
org.skywalking.apm.toolkit.activation.opentracing.span.SkyWalkingSpanActivation opentracing=org.skywalking.apm.toolkit.activation.opentracing.span.SkyWalkingSpanActivation
org.skywalking.apm.toolkit.activation.opentracing.tracer.SkyWalkingTracerActivation opentracing=org.skywalking.apm.toolkit.activation.opentracing.tracer.SkyWalkingTracerActivation
\ No newline at end of file
org.skywalking.apm.toolkit.activation.trace.TraceContextActivation tracecontext=org.skywalking.apm.toolkit.activation.trace.TraceContextActivation
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册