Merge branch 'master' into feature/365
This commit is contained in:
commit
f281f842eb
|
|
@ -30,7 +30,7 @@ public class Config {
|
|||
* If the operation name of the first span is included in this set,
|
||||
* this segment should be ignored.
|
||||
*/
|
||||
public static String IGNORE_SUFFIX = ".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html";
|
||||
public static String IGNORE_SUFFIX = ".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg";
|
||||
}
|
||||
|
||||
public static class Collector {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@
|
|||
<artifactId>apm-springmvc-annotation-4.x-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>apm-spring-cloud-feign-1.x-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- activation -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -85,12 +85,14 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
|
|||
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Object ret) throws Throwable {
|
||||
Response response = (Response)ret;
|
||||
int statusCode = response.status();
|
||||
if (response != null) {
|
||||
int statusCode = response.status();
|
||||
|
||||
AbstractSpan span = ContextManager.activeSpan();
|
||||
if (statusCode >= 400) {
|
||||
span.errorOccurred();
|
||||
Tags.STATUS_CODE.set(span, statusCode + "");
|
||||
AbstractSpan span = ContextManager.activeSpan();
|
||||
if (statusCode >= 400) {
|
||||
span.errorOccurred();
|
||||
Tags.STATUS_CODE.set(span, statusCode + "");
|
||||
}
|
||||
}
|
||||
|
||||
ContextManager.stopSpan();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ public class JDBCDriverInterceptor implements InstanceMethodsAroundInterceptor {
|
|||
|
||||
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Object ret) throws Throwable {
|
||||
return new SWConnection((String)allArguments[0],
|
||||
(Properties)allArguments[1], (Connection)ret);
|
||||
if (ret != null) {
|
||||
return new SWConnection((String)allArguments[0],
|
||||
(Properties)allArguments[1], (Connection)ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<module>concurrent-util-4.x-plugin</module>
|
||||
<module>resttemplate-4.x-plugin</module>
|
||||
<module>mvc-annotation-4.x-plugin</module>
|
||||
<module>spring-cloud</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?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>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>spring-cloud</artifactId>
|
||||
<version>3.2-2017</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>netflix-plugins</artifactId>
|
||||
<modules>
|
||||
<module>spring-cloud-feign-1.x-plugin</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>netflix-plugins</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>netflix-plugins</artifactId>
|
||||
<version>3.2-2017</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>apm-spring-cloud-feign-1.x-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<!-- only support spring cloud feign 1.1.x, 1.2.x, 1.3.x -->
|
||||
<name>spring-cloud-feign-1.x-plugin</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-feign</artifactId>
|
||||
<version>1.1.0.RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>apm-feign-default-http-9.x-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package org.skywalking.apm.plugin.spring.cloud.netflix.feign.v11.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.agent.core.plugin.match.ClassMatch;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
* {@link NetflixFeignInstrumentation} presents that skywalking intercepts {@link org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient#execute(feign.Request,
|
||||
* feign.Request.Options)} by using {@link org.skywalking.apm.plugin.feign.http.v9.DefaultHttpClientInterceptor}.
|
||||
*
|
||||
* @author zhangxin
|
||||
*/
|
||||
public class NetflixFeignInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
|
||||
/**
|
||||
* Enhance class.
|
||||
*/
|
||||
private static final String ENHANCE_CLASS = "org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient";
|
||||
|
||||
/**
|
||||
* Intercept class.
|
||||
*/
|
||||
private static final String INTERCEPT_CLASS = "org.skywalking.apm.plugin.feign.http.v9.DefaultHttpClientInterceptor";
|
||||
|
||||
@Override protected ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("execute");
|
||||
}
|
||||
|
||||
@Override public String getMethodsInterceptor() {
|
||||
return INTERCEPT_CLASS;
|
||||
}
|
||||
|
||||
@Override public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
spring-cloud-feign-1.x=org.skywalking.apm.plugin.spring.cloud.netflix.feign.v11.define.NetflixFeignInstrumentation
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?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>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>spring-plugins</artifactId>
|
||||
<version>3.2-2017</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud</artifactId>
|
||||
<modules>
|
||||
<module>netflix-plugins</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>spring-cloud</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
Loading…
Reference in New Issue