Skip to content

Commit 1aabdb6

Browse files
authored
Fix MongoDB 4.11+, add Feign 12.2+ PathVar, add MariaDB 3.x plugin, remove PostgreSQL 9.4 from test (#802)
1 parent bc1bc3e commit 1aabdb6

File tree

44 files changed

+2094
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2094
-7
lines changed

.github/workflows/plugins-test.3.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
- vertx-web-3.54minus-scenario
8383
- vertx-web-3.6plus-scenario
8484
- mariadb-scenario
85+
- mariadb-3.x-scenario
8586
- micronaut-http-scenario
8687
- nats-2.14.x-2.16.5-scenario
8788
- quasar-scenario

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ Release Notes.
1212
* Extend MySQL plugin to support MySQL Connector/J 8.4.0 and 9.x (9.0 -> 9.6).
1313
* Extend MariaDB plugin to support MariaDB Connector/J 2.7.x.
1414
* Extend MongoDB 4.x plugin to support MongoDB Java Driver 4.2 -> 4.10. Fix db.bind_vars extraction for driver 4.9+ where InsertOperation/DeleteOperation/UpdateOperation classes were removed.
15+
* Fix MongoDB 4.x plugin for driver 4.11+ where Cluster.getDescription() was removed, use getCurrentDescription() instead.
1516
* Extend Feign plugin to support OpenFeign 10.x, 11.x, 12.1.
17+
* Add Feign 12.2+ PathVar support (BuildTemplateByResolvingArgs moved to RequestTemplateFactoryResolver).
1618
* Extend Undertow plugin to support Undertow 2.1.x, 2.2.x, 2.3.x.
1719
* Extend GraphQL plugin to support graphql-java 18 -> 24 (20+ requires JDK 17).
1820
* Extend Spring Kafka plugin to support Spring Kafka 2.4 -> 2.9 and 3.0 -> 3.3.
1921
* Enhance test/plugin/run.sh to support extra Maven properties per version in support-version.list (format: version,key=value).
22+
* Add MariaDB 3.x plugin (all classes renamed in 3.x).
2023

2124
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/249?closed=1)
2225

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.feign.http.v9.define;
20+
21+
import net.bytebuddy.description.method.MethodDescription;
22+
import net.bytebuddy.matcher.ElementMatcher;
23+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
24+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
26+
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
27+
28+
import static net.bytebuddy.matcher.ElementMatchers.named;
29+
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
30+
31+
public class PathVarV2Instrumentation extends ClassInstanceMethodsEnhancePluginDefine {
32+
33+
/**
34+
* Enhance class.
35+
*/
36+
private static final String ENHANCE_CLASS = "feign.RequestTemplateFactoryResolver$BuildTemplateByResolvingArgs";
37+
38+
/**
39+
* Intercept class.
40+
*/
41+
private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.feign.http.v9.PathVarInterceptor";
42+
43+
@Override
44+
protected ClassMatch enhanceClass() {
45+
return byName(ENHANCE_CLASS);
46+
}
47+
48+
@Override
49+
protected String[] witnessClasses() {
50+
return new String[] {"feign.RequestTemplateFactoryResolver"};
51+
}
52+
53+
@Override
54+
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
55+
return new ConstructorInterceptPoint[0];
56+
}
57+
58+
@Override
59+
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
60+
return new InstanceMethodsInterceptPoint[] {
61+
new InstanceMethodsInterceptPoint() {
62+
@Override
63+
public ElementMatcher<MethodDescription> getMethodsMatcher() {
64+
return named("resolve");
65+
}
66+
67+
@Override
68+
public String getMethodsInterceptor() {
69+
return INTERCEPT_CLASS;
70+
}
71+
72+
@Override
73+
public boolean isOverrideArgs() {
74+
return false;
75+
}
76+
}
77+
};
78+
}
79+
}

apm-sniffer/apm-sdk-plugin/feign-default-http-9.x-plugin/src/main/resources/skywalking-plugin.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
# limitations under the License.
1616

1717
feign-default-http-9.x=org.apache.skywalking.apm.plugin.feign.http.v9.define.DefaultHttpClientInstrumentation
18-
feign-pathvar-9.x=org.apache.skywalking.apm.plugin.feign.http.v9.define.PathVarInstrumentation
18+
feign-pathvar-9.x=org.apache.skywalking.apm.plugin.feign.http.v9.define.PathVarInstrumentation
19+
feign-pathvar-9.x=org.apache.skywalking.apm.plugin.feign.http.v9.define.PathVarV2Instrumentation
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one or more
3+
~ contributor license agreements. See the NOTICE file distributed with
4+
~ this work for additional information regarding copyright ownership.
5+
~ The ASF licenses this file to You under the Apache License, Version 2.0
6+
~ (the "License"); you may not use this file except in compliance with
7+
~ the License. You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
~
17+
-->
18+
19+
<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">
20+
<parent>
21+
<artifactId>apm-sdk-plugin</artifactId>
22+
<groupId>org.apache.skywalking</groupId>
23+
<version>9.7.0-SNAPSHOT</version>
24+
</parent>
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<artifactId>apm-mariadb-3.x-plugin</artifactId>
28+
<packaging>jar</packaging>
29+
30+
<name>mariadb-3.x-plugin</name>
31+
<url>http://maven.apache.org</url>
32+
33+
<properties>
34+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35+
<mariadb-java-client.version>3.5.1</mariadb-java-client.version>
36+
</properties>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.mariadb.jdbc</groupId>
41+
<artifactId>mariadb-java-client</artifactId>
42+
<version>${mariadb-java-client.version}</version>
43+
<scope>provided</scope>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.apache.skywalking</groupId>
47+
<artifactId>apm-jdbc-commons</artifactId>
48+
<version>${project.version}</version>
49+
<scope>provided</scope>
50+
</dependency>
51+
</dependencies>
52+
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<artifactId>maven-deploy-plugin</artifactId>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.jdbc.mariadb.v3;
20+
21+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
22+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
23+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
24+
import org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
25+
import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
26+
27+
import java.lang.reflect.Method;
28+
29+
public class CreateCallableStatementInterceptor implements InstanceMethodsAroundInterceptor {
30+
@Override
31+
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
32+
MethodInterceptResult result) {
33+
34+
}
35+
36+
@Override
37+
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
38+
Object ret) {
39+
if (ret instanceof EnhancedInstance) {
40+
((EnhancedInstance) ret).setSkyWalkingDynamicField(new StatementEnhanceInfos((ConnectionInfo) objInst.getSkyWalkingDynamicField(), (String) allArguments[0], "CallableStatement"));
41+
}
42+
return ret;
43+
}
44+
45+
@Override
46+
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
47+
Class<?>[] argumentsTypes, Throwable t) {
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.jdbc.mariadb.v3;
20+
21+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
22+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
23+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
24+
import org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
25+
import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
26+
27+
import java.lang.reflect.Method;
28+
29+
public class CreatePreparedStatementInterceptor implements InstanceMethodsAroundInterceptor {
30+
@Override
31+
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
32+
MethodInterceptResult result) {
33+
34+
}
35+
36+
@Override
37+
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
38+
Object ret) {
39+
if (ret instanceof EnhancedInstance) {
40+
((EnhancedInstance) ret).setSkyWalkingDynamicField(new StatementEnhanceInfos((ConnectionInfo) objInst.getSkyWalkingDynamicField(), (String) allArguments[0], "PreparedStatement"));
41+
}
42+
return ret;
43+
}
44+
45+
@Override
46+
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
47+
Class<?>[] argumentsTypes, Throwable t) {
48+
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.jdbc.mariadb.v3;
20+
21+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
22+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
23+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
24+
import org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
25+
import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
26+
27+
import java.lang.reflect.Method;
28+
29+
public class CreateStatementInterceptor implements InstanceMethodsAroundInterceptor {
30+
@Override
31+
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
32+
MethodInterceptResult result) {
33+
34+
}
35+
36+
@Override
37+
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
38+
Object ret) {
39+
if (ret instanceof EnhancedInstance) {
40+
((EnhancedInstance) ret).setSkyWalkingDynamicField(new StatementEnhanceInfos((ConnectionInfo) objInst.getSkyWalkingDynamicField(), "", "Statement"));
41+
}
42+
return ret;
43+
}
44+
45+
@Override
46+
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
47+
Class<?>[] argumentsTypes, Throwable t) {
48+
49+
}
50+
}

0 commit comments

Comments
 (0)