You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2023/02/24 04:23:46 UTC

[skywalking-java] 01/01: Try to fix Spring 6 test case

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch spring6
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git

commit 99a556c68298d8fe15fed7770b7f3686006b8f62
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri Feb 24 12:23:37 2023 +0800

    Try to fix Spring 6 test case
---
 .github/workflows/plugins-jdk17-test.1.yaml                         | 3 +++
 .../resttemplate/v6x/sync/define/RestTemplateInstrumentation.java   | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/plugins-jdk17-test.1.yaml b/.github/workflows/plugins-jdk17-test.1.yaml
index d820466d8c..6a671c312b 100644
--- a/.github/workflows/plugins-jdk17-test.1.yaml
+++ b/.github/workflows/plugins-jdk17-test.1.yaml
@@ -17,6 +17,9 @@
 name: Test
 
 on:
+  push:
+    branches:
+      - spring6
   pull_request:
     paths:
       - '.github/workflows/plugins-*.yaml'
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
index c9fdb3823d..94aa84b98d 100644
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
+++ b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
@@ -20,12 +20,14 @@ package org.apache.skywalking.apm.plugin.spring.resttemplate.v6x.sync.define;
 
 import net.bytebuddy.description.method.MethodDescription;
 import net.bytebuddy.matcher.ElementMatcher;
+import net.bytebuddy.matcher.ElementMatchers;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
 import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
 
 import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
 import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
 
 /**
@@ -59,7 +61,9 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug
             new InstanceMethodsInterceptPoint() {
                 @Override
                 public ElementMatcher<MethodDescription> getMethodsMatcher() {
-                    return named(DO_EXECUTE_METHOD_NAME);
+                    return named(DO_EXECUTE_METHOD_NAME)
+                            .and(takesArgument(0, named("java.net.URI")))
+                            .and(takesArgument(2, named("org.springframework.http.HttpMethod")));
                 }
 
                 @Override