From a55f14361c95a5ee4b502a823a45106fd05747f7 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sat, 18 Oct 2025 16:38:46 +0800 Subject: [PATCH 01/33] fix --- .../jdk-httpclient-plugin/pom.xml | 49 ++++++++++ .../apm/plugin/HttpClientSendInterceptor.java | 89 +++++++++++++++++++ .../plugin/HttpRequestHeadersInterceptor.java | 62 +++++++++++++ .../define/HttpClientInstrumentation.java | 85 ++++++++++++++++++ .../define/HttpRequestInstrumentation.java | 74 +++++++++++++++ .../src/main/resources/skywalking-plugin.def | 18 ++++ apm-sniffer/bootstrap-plugins/pom.xml | 1 + 7 files changed, 378 insertions(+) create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/pom.xml create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpRequestHeadersInterceptor.java create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/pom.xml b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/pom.xml new file mode 100644 index 0000000000..84e1c1373a --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/pom.xml @@ -0,0 +1,49 @@ + + + + + bootstrap-plugins + org.apache.skywalking + 9.6.0-SNAPSHOT + + 4.0.0 + + apm-jdk-httpclient-plugin + jar + + apm-jdk-httpclient-plugin + http://maven.apache.org + + + UTF-8 + 11 + 11 + 11 + 11 + + + + + + maven-deploy-plugin + + + + + \ No newline at end of file diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java new file mode 100644 index 0000000000..366efa7b3b --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin; + +import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.context.tag.Tags; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; + +import java.lang.reflect.Method; +import java.net.URI; +import java.net.http.HttpRequest; + +public class HttpClientSendInterceptor implements InstanceMethodsAroundInterceptor { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + HttpRequest request = (HttpRequest) allArguments[0]; + URI uri = request.uri(); + + ContextCarrier contextCarrier = new ContextCarrier(); + AbstractSpan span = ContextManager.createExitSpan(buildOperationName(request.method(), uri), contextCarrier, getPeer(uri)); + + if (request instanceof EnhancedInstance) { + ((EnhancedInstance) request).setSkyWalkingDynamicField(contextCarrier); + } + + span.setComponent(ComponentsDefine.JDK_HTTP); + Tags.HTTP.METHOD.set(span, request.method()); + Tags.URL.set(span, String.valueOf(uri)); + SpanLayer.asHttp(span); + } + + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { + + if (ContextManager.isActive()) { + ContextManager.stopSpan(); + } + return ret; + } + + @Override + public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { + if (ContextManager.isActive()) { + ContextManager.activeSpan().log(t); + } + } + + private String buildOperationName(String method, URI uri) { + String path = uri.getPath(); + if (path == null || path.isEmpty()) { + path = "/"; + } + return method + ":" + path; + } + + private String getPeer(URI uri) { + String host = uri.getHost(); + int port = uri.getPort(); + + if (port == -1) { + port = "https".equalsIgnoreCase(uri.getScheme()) ? 443 : 80; + } + + return host + ":" + port; + } +} diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpRequestHeadersInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpRequestHeadersInterceptor.java new file mode 100644 index 0000000000..a6dc76650f --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpRequestHeadersInterceptor.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin; + +import org.apache.skywalking.apm.agent.core.context.CarrierItem; +import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; + +import java.lang.reflect.Method; +import java.net.http.HttpHeaders; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HttpRequestHeadersInterceptor implements InstanceMethodsAroundInterceptor { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + + } + + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { + + ContextCarrier contextCarrier = (ContextCarrier) objInst.getSkyWalkingDynamicField(); + HttpHeaders originalHeaders = (HttpHeaders) ret; + final Map> headerMap = new HashMap<>(originalHeaders.map()); + CarrierItem next = contextCarrier.items(); + while (next.hasNext()) { + next = next.next(); + headerMap.put(next.getHeadKey(), List.of(next.getHeadValue())); + } + + return HttpHeaders.of(headerMap, (k, v) -> true); + } + + @Override + public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { + if (ContextManager.isActive()) { + ContextManager.activeSpan().log(t); + } + } +} diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java new file mode 100644 index 0000000000..74d67391bd --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin.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.ConstructorInterceptPoint; +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.match.ClassMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.IndirectMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.MultiClassNameMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.logical.LogicalMatchOperation; + +import static net.bytebuddy.matcher.ElementMatchers.named; + +public class HttpClientInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String ENHANCE_PARENT_CLASS = "java.net.http.HttpClient"; + + private static final String EXCLUDE_CLASS = "jdk.internal.net.http.HttpClientFacade"; + + private static final String INTERCEPT_SEND_METHOD = "send"; + + private static final String INTERCEPT_SEND_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; + + @Override + public boolean isBootstrapInstrumentation() { + return true; + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[0]; + } + + @Override + protected ClassMatch enhanceClass() { + IndirectMatch parentType = HierarchyMatch.byHierarchyMatch(ENHANCE_PARENT_CLASS); + IndirectMatch excludeClass = LogicalMatchOperation.not(MultiClassNameMatch.byMultiClassMatch(EXCLUDE_CLASS)); + return LogicalMatchOperation.and(parentType, excludeClass); + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[]{ + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return ElementMatchers.named(INTERCEPT_SEND_METHOD) + .and(ElementMatchers.takesArguments(2)) + .and(ElementMatchers.takesArgument(0, named("java.net.http.HttpRequest"))); + } + + @Override + public String getMethodsInterceptor() { + return INTERCEPT_SEND_HANDLE; + } + + @Override + public boolean isOverrideArgs() { + return true; + } + } + }; + } +} diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java new file mode 100644 index 0000000000..d551eab3da --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin.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.ConstructorInterceptPoint; +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.match.ClassMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch; + +public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String ENHANCE_PARENT_CLASS = "java.net.http.HttpRequest"; + + private static final String INTERCEPT_HEADERS_METHOD = "headers"; + + private static final String INTERCEPT_HEADERS_HANDLE = "org.apache.skywalking.apm.plugin.HttpRequestHeadersInterceptor"; + + @Override + public boolean isBootstrapInstrumentation() { + return true; + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[0]; + } + + @Override + protected ClassMatch enhanceClass() { + return HierarchyMatch.byHierarchyMatch(ENHANCE_PARENT_CLASS); + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[]{ + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return ElementMatchers.named(INTERCEPT_HEADERS_METHOD); + } + + @Override + public String getMethodsInterceptor() { + return INTERCEPT_HEADERS_HANDLE; + } + + @Override + public boolean isOverrideArgs() { + return true; + } + } + }; + } +} diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def new file mode 100644 index 0000000000..e4d1ef2562 --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +jdk-httpclient-plugin=org.apache.skywalking.apm.plugin.define.HttpClientInstrumentation +jdk-httpclient-plugin=org.apache.skywalking.apm.plugin.define.HttpRequestInstrumentation \ No newline at end of file diff --git a/apm-sniffer/bootstrap-plugins/pom.xml b/apm-sniffer/bootstrap-plugins/pom.xml index 8d1424343c..cf1285cc07 100644 --- a/apm-sniffer/bootstrap-plugins/pom.xml +++ b/apm-sniffer/bootstrap-plugins/pom.xml @@ -44,6 +44,7 @@ jdk-threadpool-plugin jdk-forkjoinpool-plugin jdk-virtual-thread-executor-plugin + jdk-httpclient-plugin From d79fb55d06d9c8b1d7c5dd98960d8632ac727ab8 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Wed, 22 Oct 2025 23:08:17 +0800 Subject: [PATCH 02/33] fix --- .../define/HttpClientInstrumentation.java | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java index 74d67391bd..c85b58e767 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java @@ -40,7 +40,10 @@ public class HttpClientInstrumentation extends ClassInstanceMethodsEnhancePlugin private static final String INTERCEPT_SEND_METHOD = "send"; - private static final String INTERCEPT_SEND_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; + private static final String INTERCEPT_SEND_ASYNC_METHOD = "sendAsync"; + + private static final String INTERCEPT_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; + @Override public boolean isBootstrapInstrumentation() { @@ -66,20 +69,40 @@ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { @Override public ElementMatcher getMethodsMatcher() { return ElementMatchers.named(INTERCEPT_SEND_METHOD) - .and(ElementMatchers.takesArguments(2)) - .and(ElementMatchers.takesArgument(0, named("java.net.http.HttpRequest"))); + .and(ElementMatchers.takesArgument(0, named("java.net.http.HttpRequest"))) + .and(ElementMatchers.takesArguments(2)); + } + + @Override + public String getMethodsInterceptor() { + return INTERCEPT_HANDLE; + } + + @Override + public boolean isOverrideArgs() { + return false; + } + }, + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return ElementMatchers.named(INTERCEPT_SEND_ASYNC_METHOD) + .and(ElementMatchers.takesArgument(0, named("java.net.http.HttpRequest"))) + .and(ElementMatchers.takesArgument(1, named("java.net.http.HttpResponse$BodyHandler"))) + .and(ElementMatchers.takesArgument(2, named("java.net.http.HttpResponse$PushPromiseHandler"))) + .and(ElementMatchers.takesArguments(3)); } @Override public String getMethodsInterceptor() { - return INTERCEPT_SEND_HANDLE; + return INTERCEPT_HANDLE; } @Override public boolean isOverrideArgs() { - return true; + return false; } - } + }, }; } } From 711963c7ccb272d915a79f4c2a512825c6de555b Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Wed, 22 Oct 2025 23:10:36 +0800 Subject: [PATCH 03/33] fix --- .github/workflows/plugins-jdk11-test.3.yaml | 1 + .../jdk-httpclient-scenario/bin/startup.sh | 21 +++ .../config/expectedData.yaml | 78 +++++++++++ .../jdk-httpclient-scenario/configuration.yml | 22 +++ .../scenarios/jdk-httpclient-scenario/pom.xml | 128 ++++++++++++++++++ .../src/main/assembly/assembly.xml | 41 ++++++ .../testcase/jdk/httpclient/Application.java | 30 ++++ .../httpclient/controller/CaseController.java | 64 +++++++++ .../httpclient/controller/UserController.java | 37 +++++ .../jdk/httpclient/dto/UserLoginDTO.java | 40 ++++++ .../src/main/resources/application.yaml | 21 +++ .../support-version.list | 17 +++ 12 files changed, 500 insertions(+) create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/pom.xml create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/Application.java create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/dto/UserLoginDTO.java create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml create mode 100644 test/plugin/scenarios/jdk-httpclient-scenario/support-version.list diff --git a/.github/workflows/plugins-jdk11-test.3.yaml b/.github/workflows/plugins-jdk11-test.3.yaml index a1f90fff14..0e1fe2f74b 100644 --- a/.github/workflows/plugins-jdk11-test.3.yaml +++ b/.github/workflows/plugins-jdk11-test.3.yaml @@ -55,6 +55,7 @@ jobs: matrix: case: - jdk11-forkjoinpool-scenario + - jdk-httpclient-scenario steps: - uses: actions/checkout@v2 with: diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh b/test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh new file mode 100644 index 0000000000..6c3e9e8b21 --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} ${home}/../libs/jdk-httpclient-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml new file mode 100644 index 0000000000..8202e85547 --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -0,0 +1,78 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +segmentItems: + - serviceName: jdk-httpclient-scenario + segmentSize: gt 0 + segments: + - segmentId: not null + spans: + - operationName: POST:/user/login + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 14 + isError: false + spanType: Entry + peer: '' + skipAnalysis: 'false' + tags: + - { key: http.method, value: POST } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - { key: http.status_code, value: '200' } + refs: + - { parentEndpoint: POST:/jdk-httpclient-scenario/user/login, networkAddress: 'localhost:8080', + refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: jdk-httpclient-scenario, traceId: not null } + - segmentId: not null + spans: + - operationName: POST:/jdk-httpclient-scenario/user/login + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 66 + isError: false + spanType: Exit + peer: not null + skipAnalysis: 'false' + tags: + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - { key: http.method, value: POST } + - { key: http.status_code, value: '200' } + refs: + - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: '', + refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: jdk-httpclient-scenario, traceId: not null } + - segmentId: not null + spans: + - operationName: GET:/case/jdk-httpclient-scenario-case + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 14 + isError: false + spanType: Entry + peer: '' + tags: + - { key: url, value: not null } + - { key: http.method, value: GET } + - { key: http.status_code, value: '200' } + skipAnalysis: 'false' diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml new file mode 100644 index 0000000000..ab6f3d9809 --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: jvm +entryService: http://localhost:8080/jdk-httpclient-scenario/case +healthCheck: http://localhost:8080/jdk-httpclient-scenario/healthCheck +runningMode: with_bootstrap +withPlugins: apm-jdk-httpclient-plugin-*.jar +startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/pom.xml b/test/plugin/scenarios/jdk-httpclient-scenario/pom.xml new file mode 100644 index 0000000000..406bb8f57d --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/pom.xml @@ -0,0 +1,128 @@ + + + + 4.0.0 + + org.apache.skywalking + jdk-httpclient-scenario + 5.0.0 + + + UTF-8 + 11 + 3.8.1 + 2.7.15 + + + skywalking-jdk-httpclient-scenario + + + + org.springframework.boot + spring-boot-starter-web + 2.7.15 + + + + com.alibaba + fastjson + 1.2.83 + + + + + jdk-httpclient-scenario + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + ./target/ + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + false + + + + + org.apache.maven.plugins + maven-jar-plugin + + + empty-javadoc-jar + package + + jar + + + javadoc + ${basedir}/javadoc + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/assembly/assembly.xml new file mode 100644 index 0000000000..3ab23573ab --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ./target/jdk-httpclient-scenario.jar + ./libs + 0775 + + + \ No newline at end of file diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/Application.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/Application.java new file mode 100644 index 0000000000..5147a224ee --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/Application.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test.apache.skywalking.apm.testcase.jdk.httpclient; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java new file mode 100644 index 0000000000..889adc88ca --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test.apache.skywalking.apm.testcase.jdk.httpclient.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +@RestController +@RequestMapping("/case") +public class CaseController { + + @GetMapping("/healthCheck") + public String healthCheck() { + return "Success"; + } + + @GetMapping("/jdk-httpclient-scenario-case") + public String testCase() throws InterruptedException, IOException { + HttpClient client = HttpClient.newBuilder() + .connectTimeout(Duration.ofSeconds(10)) + .build(); + + String json = "{\n" + + " \"username\": \"Alice\",\n" + + " \"password\": 21231231231\n" + + "}"; + + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/login")) + .timeout(Duration.ofSeconds(10)) + .header("Content-Type", "application/json") + .POST(HttpRequest.BodyPublishers.ofString(json)) + .build(); + + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + System.out.println("Status code: " + response.statusCode()); + System.out.println("Headers: " + response.headers()); + System.out.println("Response body: " + response.body()); + return "success"; + } +} diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java new file mode 100644 index 0000000000..ebe1af688f --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test.apache.skywalking.apm.testcase.jdk.httpclient.controller; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import test.apache.skywalking.apm.testcase.jdk.httpclient.dto.UserLoginDTO; + +@RestController +@RequestMapping("/user") +public class UserController { + @PostMapping("/login") + public JSONObject login(@RequestBody UserLoginDTO userLoginDTO) { + JSONObject resultJson = new JSONObject(); + resultJson.put("code", 200); + resultJson.put("message", "success"); + return resultJson; + } +} diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/dto/UserLoginDTO.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/dto/UserLoginDTO.java new file mode 100644 index 0000000000..1226f82d2d --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/dto/UserLoginDTO.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test.apache.skywalking.apm.testcase.jdk.httpclient.dto; + +public class UserLoginDTO { + private String username; + + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml new file mode 100644 index 0000000000..2bed23f8ca --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +server: + port: 8080 + servlet: + context-path: /jdk-httpclient-scenario + diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/support-version.list b/test/plugin/scenarios/jdk-httpclient-scenario/support-version.list new file mode 100644 index 0000000000..feef03cdea --- /dev/null +++ b/test/plugin/scenarios/jdk-httpclient-scenario/support-version.list @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +all \ No newline at end of file From 6207a80f0986d340345f91f625b41bb6ab6ed0b6 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 08:32:53 +0800 Subject: [PATCH 04/33] Fix --- .../skywalking/apm/plugin/define/HttpClientInstrumentation.java | 1 - 1 file changed, 1 deletion(-) diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java index c85b58e767..1c415039de 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java @@ -44,7 +44,6 @@ public class HttpClientInstrumentation extends ClassInstanceMethodsEnhancePlugin private static final String INTERCEPT_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; - @Override public boolean isBootstrapInstrumentation() { return true; From eba26a2312f84e31843f832d01aa66aaa9c9f88a Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 08:52:01 +0800 Subject: [PATCH 05/33] Fix --- .../testcase/jdk/httpclient/controller/CaseController.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java index 889adc88ca..7397dd6658 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java @@ -55,10 +55,7 @@ public String testCase() throws InterruptedException, IOException { .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); - HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); - System.out.println("Status code: " + response.statusCode()); - System.out.println("Headers: " + response.headers()); - System.out.println("Response body: " + response.body()); + client.send(request, HttpResponse.BodyHandlers.ofString()); return "success"; } } From 0e3031666ab122dd5dc2d7c1c1f2b48844dac015 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 11:57:01 +0800 Subject: [PATCH 06/33] Fix --- .../scenarios/jdk-httpclient-scenario/configuration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml index ab6f3d9809..a5fe9c2cb1 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml @@ -15,8 +15,8 @@ # limitations under the License. type: jvm -entryService: http://localhost:8080/jdk-httpclient-scenario/case -healthCheck: http://localhost:8080/jdk-httpclient-scenario/healthCheck +entryService: http://localhost:8080/jdk-httpclient-scenario/case/jdk-httpclient-scenario-case +healthCheck: http://localhost:8080/jdk-httpclient-scenario/case/healthCheck runningMode: with_bootstrap withPlugins: apm-jdk-httpclient-plugin-*.jar startScript: ./bin/startup.sh From 508f01b1c11fe42dcba2fd7fcf6eb6abf0863dbe Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 12:45:03 +0800 Subject: [PATCH 07/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 8202e85547..68263f5802 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -52,8 +52,8 @@ segmentItems: peer: not null skipAnalysis: 'false' tags: - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - { key: http.method, value: POST } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - { key: http.status_code, value: '200' } refs: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: '', From c214ede01134c6d7f8092f886e28d8c3a6fac5d1 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 19:40:50 +0800 Subject: [PATCH 08/33] Fix --- .../jdk-httpclient-scenario/config/expectedData.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 68263f5802..3f148d86d5 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -31,18 +31,18 @@ segmentItems: peer: '' skipAnalysis: 'false' tags: - - { key: http.method, value: POST } - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - { key: http.method, value: POST } - { key: http.status_code, value: '200' } refs: - - { parentEndpoint: POST:/jdk-httpclient-scenario/user/login, networkAddress: 'localhost:8080', + - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null spans: - operationName: POST:/jdk-httpclient-scenario/user/login - parentSpanId: -1 - spanId: 0 + parentSpanId: 0 + spanId: 1 spanLayer: Http startTime: not null endTime: not null From 3a218aa1a3e7c9ee7a307ff761d54f864a667a6a Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 20:28:43 +0800 Subject: [PATCH 09/33] Fix --- docs/en/setup/service-agent/java-agent/Plugin-list.md | 1 + .../jdk-httpclient-scenario/config/expectedData.yaml | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md index 58a3a50ffc..7d8933e5d3 100644 --- a/docs/en/setup/service-agent/java-agent/Plugin-list.md +++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md @@ -47,6 +47,7 @@ - influxdb-2.x - jackson-2.x - jdk-http-plugin +- jdk-httpclient-plugin - jdk-threading-plugin - jdk-virtual-thread-executor-plugin - jedis-2.x-3.x diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 3f148d86d5..6f5a49cfa9 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -55,10 +55,7 @@ segmentItems: - { key: http.method, value: POST } - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - { key: http.status_code, value: '200' } - refs: - - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: '', - refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: jdk-httpclient-scenario, traceId: not null } + - segmentId: not null spans: - operationName: GET:/case/jdk-httpclient-scenario-case From 9d5205f185653ccf0fa6198968c1c250d739cf2c Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 22:18:49 +0800 Subject: [PATCH 10/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 6f5a49cfa9..690181e906 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -40,7 +40,7 @@ segmentItems: null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null spans: - - operationName: POST:/jdk-httpclient-scenario/user/login + - operationName: POST:/user/login parentSpanId: 0 spanId: 1 spanLayer: Http From b7076ccfc00db16ceab43e75c0c1a190e514e753 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 22:22:14 +0800 Subject: [PATCH 11/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 690181e906..6d55a79f99 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -40,7 +40,7 @@ segmentItems: null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null spans: - - operationName: POST:/user/login + - operationName: POST:/jdk-httpclient-scenario/user/login parentSpanId: 0 spanId: 1 spanLayer: Http @@ -54,7 +54,6 @@ segmentItems: tags: - { key: http.method, value: POST } - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - - { key: http.status_code, value: '200' } - segmentId: not null spans: From 20eb38a698ec764850d7d70446ba1ed5b3fce336 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Thu, 23 Oct 2025 22:42:21 +0800 Subject: [PATCH 12/33] Fix --- .../config/expectedData.yaml | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 6d55a79f99..df2a2492df 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -38,22 +38,6 @@ segmentItems: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: jdk-httpclient-scenario, traceId: not null } - - segmentId: not null - spans: - - operationName: POST:/jdk-httpclient-scenario/user/login - parentSpanId: 0 - spanId: 1 - spanLayer: Http - startTime: not null - endTime: not null - componentId: 66 - isError: false - spanType: Exit - peer: not null - skipAnalysis: 'false' - tags: - - { key: http.method, value: POST } - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - segmentId: not null spans: @@ -72,3 +56,18 @@ segmentItems: - { key: http.method, value: GET } - { key: http.status_code, value: '200' } skipAnalysis: 'false' + + - operationName: POST:/jdk-httpclient-scenario/user/login + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 66 + isError: false + spanType: Exit + peer: not null + skipAnalysis: 'false' + tags: + - { key: http.method, value: POST } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } From 80e90037528e9074332638625e711456c332e284 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 08:51:24 +0800 Subject: [PATCH 13/33] Fix --- .../config/expectedData.yaml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index df2a2492df..92f6e4244d 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -41,6 +41,21 @@ segmentItems: - segmentId: not null spans: + - operationName: POST:/jdk-httpclient-scenario/user/login + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 66 + isError: false + spanType: Exit + peer: not null + skipAnalysis: 'false' + tags: + - { key: http.method, value: POST } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - operationName: GET:/case/jdk-httpclient-scenario-case parentSpanId: -1 spanId: 0 @@ -56,18 +71,3 @@ segmentItems: - { key: http.method, value: GET } - { key: http.status_code, value: '200' } skipAnalysis: 'false' - - - operationName: POST:/jdk-httpclient-scenario/user/login - parentSpanId: 0 - spanId: 1 - spanLayer: Http - startTime: not null - endTime: not null - componentId: 66 - isError: false - spanType: Exit - peer: not null - skipAnalysis: 'false' - tags: - - { key: http.method, value: POST } - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } From 626a629b7d273f0505fbc29e09a2172954e2cdf8 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 08:51:34 +0800 Subject: [PATCH 14/33] Fix --- CHANGES.md | 1 + docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index bd24e54cd1..76d64c9840 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ Release Notes. * Fix ClassLoader cache OOM issue with WeakHashMap. * Fix Jetty client cannot receive the HTTP response body. * Eliminate repeated code with HttpServletRequestWrapper in mvc-annotation-commons. +* Add the jdk httpclient plugin. All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/242?closed=1) diff --git a/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md b/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md index 7eec71899a..f03a4e21a7 100644 --- a/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md +++ b/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md @@ -8,6 +8,7 @@ Now, we have the following known bootstrap plugins. * Plugin of JDK ThreadPoolExecutor. Agent is compatible with JDK 1.8+ * Plugin of JDK ForkJoinPool. Agent is compatible with JDK 1.8+ * Plugin of JDK VirtualThreadExecutor. Agent is compatible with JDK 21+ +* Plugin of JDK HttpClient. Agent is compatible with JDK 11+ ### HttpURLConnection Plugin Notice The plugin of JDK HttpURLConnection depended on `sun.net.*`. When using Java 9+, You should add some JVM options as follows: From f9411ffbd20f940e012a8f2f3e0534a691f68d2b Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 09:25:05 +0800 Subject: [PATCH 15/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 92f6e4244d..070513dad7 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -36,7 +36,7 @@ segmentItems: - { key: http.status_code, value: '200' } refs: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', - refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null From 9a8f830cf777ddbca9437972cc56f6b9d1a56992 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 11:58:28 +0800 Subject: [PATCH 16/33] Fix --- .../jdk-httpclient-scenario/config/expectedData.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 070513dad7..16e168aa36 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -31,8 +31,8 @@ segmentItems: peer: '' skipAnalysis: 'false' tags: - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - - { key: http.method, value: POST } + - { key: url, value: not null } + - { key: http.method, value: GET } - { key: http.status_code, value: '200' } refs: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', From 45b14f2cf6fa151940e5f174d5736e1b04562561 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 11:58:37 +0800 Subject: [PATCH 17/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 16e168aa36..83e98228e4 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -32,7 +32,7 @@ segmentItems: skipAnalysis: 'false' tags: - { key: url, value: not null } - - { key: http.method, value: GET } + - { key: http.method, value: POST } - { key: http.status_code, value: '200' } refs: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', From 1853b42865a803d4a38a4798ca2030165eac988b Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 12:43:48 +0800 Subject: [PATCH 18/33] Fix --- .../config/expectedData.yaml | 36 +++++++++++++++++++ .../httpclient/controller/CaseController.java | 6 +++- .../httpclient/controller/UserController.java | 8 +++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 83e98228e4..0147385372 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -38,9 +38,45 @@ segmentItems: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: jdk-httpclient-scenario, traceId: not null } + - segmentId: not null + spans: + - operationName: POST:/user/asyncLogin + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 14 + isError: false + spanType: Entry + peer: '' + skipAnalysis: 'false' + tags: + - { key: url, value: not null } + - { key: http.method, value: POST } + - { key: http.status_code, value: '200' } + refs: + - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', + refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null spans: + - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin + parentSpanId: 0 + spanId: 2 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 66 + isError: false + spanType: Exit + peer: not null + skipAnalysis: 'false' + tags: + - { key: http.method, value: POST } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin } + - operationName: POST:/jdk-httpclient-scenario/user/login parentSpanId: 0 spanId: 1 diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java index 7397dd6658..b0f22e68df 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java @@ -27,6 +27,7 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; +import java.util.concurrent.CompletableFuture; @RestController @RequestMapping("/case") @@ -49,13 +50,16 @@ public String testCase() throws InterruptedException, IOException { "}"; HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/login")) + .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin")) .timeout(Duration.ofSeconds(10)) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); client.send(request, HttpResponse.BodyHandlers.ofString()); + + CompletableFuture> future = client.sendAsync(request, HttpResponse.BodyHandlers.ofString()); + future.join(); return "success"; } } diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java index ebe1af688f..a9665ffcb6 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/UserController.java @@ -34,4 +34,12 @@ public JSONObject login(@RequestBody UserLoginDTO userLoginDTO) { resultJson.put("message", "success"); return resultJson; } + + @PostMapping("/asyncLogin") + public JSONObject asyncLogin(@RequestBody UserLoginDTO userLoginDTO) { + JSONObject resultJson = new JSONObject(); + resultJson.put("code", 200); + resultJson.put("message", "success"); + return resultJson; + } } From c091b2527985e3ef65161fd2c1fecac5afc020ad Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 18:55:03 +0800 Subject: [PATCH 19/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 0147385372..25d6eb4c62 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -74,8 +74,9 @@ segmentItems: peer: not null skipAnalysis: 'false' tags: + - { key: url, value: not null } - { key: http.method, value: POST } - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin } + - { key: http.status_code, value: '200' } - operationName: POST:/jdk-httpclient-scenario/user/login parentSpanId: 0 From 4e415f4dc16bb6044290e8b0918dd3d43a626b05 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 19:40:53 +0800 Subject: [PATCH 20/33] Fix --- .../jdk/httpclient/controller/CaseController.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java index b0f22e68df..25d4f4e6b9 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java +++ b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java @@ -50,7 +50,7 @@ public String testCase() throws InterruptedException, IOException { "}"; HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin")) + .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/login")) .timeout(Duration.ofSeconds(10)) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) @@ -58,7 +58,13 @@ public String testCase() throws InterruptedException, IOException { client.send(request, HttpResponse.BodyHandlers.ofString()); - CompletableFuture> future = client.sendAsync(request, HttpResponse.BodyHandlers.ofString()); + HttpRequest asyncRequest = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin")) + .timeout(Duration.ofSeconds(10)) + .header("Content-Type", "application/json") + .POST(HttpRequest.BodyPublishers.ofString(json)) + .build(); + CompletableFuture> future = client.sendAsync(asyncRequest, HttpResponse.BodyHandlers.ofString()); future.join(); return "success"; } From 2392140734335fc60b83f787d8ecebbb05ccce1e Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 20:12:14 +0800 Subject: [PATCH 21/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 25d6eb4c62..86f496c7f1 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -64,7 +64,7 @@ segmentItems: spans: - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin parentSpanId: 0 - spanId: 2 + spanId: 1 spanLayer: Http startTime: not null endTime: not null From bfd2f4ce879d4f4d133a1ca31363e8675da896c6 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 21:14:08 +0800 Subject: [PATCH 22/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 86f496c7f1..25d6eb4c62 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -64,7 +64,7 @@ segmentItems: spans: - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin parentSpanId: 0 - spanId: 1 + spanId: 2 spanLayer: Http startTime: not null endTime: not null From 4431e5984324fbebad148d737d4243530237f695 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 22:14:45 +0800 Subject: [PATCH 23/33] Fix --- .../config/expectedData.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 25d6eb4c62..b9858850ed 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -62,9 +62,9 @@ segmentItems: - segmentId: not null spans: - - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin + - operationName: POST:/jdk-httpclient-scenario/user/login parentSpanId: 0 - spanId: 2 + spanId: 1 spanLayer: Http startTime: not null endTime: not null @@ -74,13 +74,12 @@ segmentItems: peer: not null skipAnalysis: 'false' tags: - - { key: url, value: not null } - { key: http.method, value: POST } - - { key: http.status_code, value: '200' } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } - - operationName: POST:/jdk-httpclient-scenario/user/login + - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin parentSpanId: 0 - spanId: 1 + spanId: 2 spanLayer: Http startTime: not null endTime: not null @@ -90,8 +89,9 @@ segmentItems: peer: not null skipAnalysis: 'false' tags: + - { key: url, value: not null } - { key: http.method, value: POST } - - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - { key: http.status_code, value: '200' } - operationName: GET:/case/jdk-httpclient-scenario-case parentSpanId: -1 From 70ce00c8d031800af37f73d3a029d37603100b5a Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 23:07:23 +0800 Subject: [PATCH 24/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index b9858850ed..5e0f8a76c6 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -91,7 +91,6 @@ segmentItems: tags: - { key: url, value: not null } - { key: http.method, value: POST } - - { key: http.status_code, value: '200' } - operationName: GET:/case/jdk-httpclient-scenario-case parentSpanId: -1 From 4aba7807329bdd50ca22d01da7ac55f88fb52703 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Fri, 24 Oct 2025 23:20:18 +0800 Subject: [PATCH 25/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 5e0f8a76c6..30b62548ca 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -89,8 +89,8 @@ segmentItems: peer: not null skipAnalysis: 'false' tags: - - { key: url, value: not null } - { key: http.method, value: POST } + - { key: url, value: not null } - operationName: GET:/case/jdk-httpclient-scenario-case parentSpanId: -1 From 91f3eecdd00a68ff4c47e202ff286a6851bf5620 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sat, 25 Oct 2025 10:17:53 +0800 Subject: [PATCH 26/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 30b62548ca..c5422cc09f 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -57,7 +57,7 @@ segmentItems: - { key: http.status_code, value: '200' } refs: - { parentEndpoint: GET:/case/jdk-httpclient-scenario-case, networkAddress: 'localhost:8080', - refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not + refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: jdk-httpclient-scenario, traceId: not null } - segmentId: not null From f4ed10b3f4ea7bb80c9ac2e09dc25dac352fec03 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sat, 25 Oct 2025 21:00:40 +0800 Subject: [PATCH 27/33] Fix --- .../HttpClientSendAsyncInterceptor.java | 118 ++++++++++++++++++ .../apm/plugin/HttpClientSendInterceptor.java | 15 +++ .../define/HttpClientInstrumentation.java | 8 +- .../config/expectedData.yaml | 1 + 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendAsyncInterceptor.java diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendAsyncInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendAsyncInterceptor.java new file mode 100644 index 0000000000..4c627879ea --- /dev/null +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendAsyncInterceptor.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.plugin; + +import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.context.tag.Tags; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; + +import java.lang.reflect.Method; +import java.net.URI; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.concurrent.CompletableFuture; + +public class HttpClientSendAsyncInterceptor implements InstanceMethodsAroundInterceptor { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + HttpRequest request = (HttpRequest) allArguments[0]; + URI uri = request.uri(); + + ContextCarrier contextCarrier = new ContextCarrier(); + AbstractSpan span = ContextManager.createExitSpan(buildOperationName(request.method(), uri), contextCarrier, getPeer(uri)); + + if (request instanceof EnhancedInstance) { + ((EnhancedInstance) request).setSkyWalkingDynamicField(contextCarrier); + } + + span.setComponent(ComponentsDefine.JDK_HTTP); + Tags.HTTP.METHOD.set(span, request.method()); + Tags.URL.set(span, String.valueOf(uri)); + SpanLayer.asHttp(span); + } + + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { + + if (ContextManager.isActive()) { + AbstractSpan span = ContextManager.activeSpan(); + span.prepareForAsync(); + + if (ret != null) { + CompletableFuture future = (CompletableFuture) ret; + future.whenComplete((response, throwable) -> { + try { + if (throwable != null) { + Tags.HTTP_RESPONSE_STATUS_CODE.set(span, 500); + span.errorOccurred(); + span.log(throwable); + } else if (response instanceof HttpResponse) { + HttpResponse httpResponse = (HttpResponse) response; + int statusCode = httpResponse.statusCode(); + Tags.HTTP_RESPONSE_STATUS_CODE.set(span, statusCode); + if (statusCode >= 400) { + span.errorOccurred(); + } + } + } finally { + span.asyncFinish(); + } + }); + } else { + Tags.HTTP_RESPONSE_STATUS_CODE.set(span, 404); + span.errorOccurred(); + } + ContextManager.stopSpan(); + } + return ret; + } + + @Override + public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { + if (ContextManager.isActive()) { + ContextManager.activeSpan().log(t); + } + } + + private String buildOperationName(String method, URI uri) { + String path = uri.getPath(); + if (path == null || path.isEmpty()) { + path = "/"; + } + return method + ":" + path; + } + + private String getPeer(URI uri) { + String host = uri.getHost(); + int port = uri.getPort(); + + if (port == -1) { + port = "https".equalsIgnoreCase(uri.getScheme()) ? 443 : 80; + } + + return host + ":" + port; + } +} diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java index 366efa7b3b..b8a9f567d9 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.net.URI; import java.net.http.HttpRequest; +import java.net.http.HttpResponse; public class HttpClientSendInterceptor implements InstanceMethodsAroundInterceptor { @@ -56,6 +57,20 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { if (ContextManager.isActive()) { + AbstractSpan span = ContextManager.activeSpan(); + if (ret != null) { + HttpResponse response = (HttpResponse) ret; + int statusCode = response.statusCode(); + + Tags.HTTP_RESPONSE_STATUS_CODE.set(span, response.statusCode()); + if (statusCode >= 400) { + span.errorOccurred(); + } + } else { + Tags.HTTP_RESPONSE_STATUS_CODE.set(span, 404); + span.errorOccurred(); + } + ContextManager.stopSpan(); } return ret; diff --git a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java index 1c415039de..18f7cf298b 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java @@ -42,7 +42,9 @@ public class HttpClientInstrumentation extends ClassInstanceMethodsEnhancePlugin private static final String INTERCEPT_SEND_ASYNC_METHOD = "sendAsync"; - private static final String INTERCEPT_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; + private static final String INTERCEPT_SEND_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendInterceptor"; + + private static final String INTERCEPT_SEND_ASYNC_HANDLE = "org.apache.skywalking.apm.plugin.HttpClientSendAsyncInterceptor"; @Override public boolean isBootstrapInstrumentation() { @@ -74,7 +76,7 @@ public ElementMatcher getMethodsMatcher() { @Override public String getMethodsInterceptor() { - return INTERCEPT_HANDLE; + return INTERCEPT_SEND_HANDLE; } @Override @@ -94,7 +96,7 @@ public ElementMatcher getMethodsMatcher() { @Override public String getMethodsInterceptor() { - return INTERCEPT_HANDLE; + return INTERCEPT_SEND_ASYNC_HANDLE; } @Override diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index c5422cc09f..3ff1c952b8 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -91,6 +91,7 @@ segmentItems: tags: - { key: http.method, value: POST } - { key: url, value: not null } + - { key: http.status_code, value: '200' } - operationName: GET:/case/jdk-httpclient-scenario-case parentSpanId: -1 From 461e90c33ad5389f37347f85b07bc97ebafcf58f Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sat, 25 Oct 2025 21:01:05 +0800 Subject: [PATCH 28/33] Fix --- .../scenarios/jdk-httpclient-scenario/config/expectedData.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index 3ff1c952b8..c3864f91e9 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -76,6 +76,7 @@ segmentItems: tags: - { key: http.method, value: POST } - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/login } + - { key: http.status_code, value: '200' } - operationName: POST:/jdk-httpclient-scenario/user/asyncLogin parentSpanId: 0 From d8b3072b21989777d26a4e2f7bec45f63a9ce747 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sun, 26 Oct 2025 09:51:52 +0800 Subject: [PATCH 29/33] Fix --- .../jdk-httpclient-scenario/config/expectedData.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml index c3864f91e9..f009e03a46 100644 --- a/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml @@ -91,7 +91,7 @@ segmentItems: skipAnalysis: 'false' tags: - { key: http.method, value: POST } - - { key: url, value: not null } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/user/asyncLogin } - { key: http.status_code, value: '200' } - operationName: GET:/case/jdk-httpclient-scenario-case @@ -105,7 +105,7 @@ segmentItems: spanType: Entry peer: '' tags: - - { key: url, value: not null } + - { key: url, value: http://localhost:8080/jdk-httpclient-scenario/case/jdk-httpclient-scenario-case } - { key: http.method, value: GET } - { key: http.status_code, value: '200' } skipAnalysis: 'false' From 87aeeabfbd84a6394933cc84471fbc669e4ae514 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sun, 26 Oct 2025 10:14:17 +0800 Subject: [PATCH 30/33] Fix --- .../handler/NettyHttpRequestEncoderTracingHandler.java | 1 - .../jdk-virtual-thread-executor-scenario/pom.xml | 8 -------- 2 files changed, 9 deletions(-) diff --git a/apm-sniffer/optional-plugins/netty-http-4.1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/http/handler/NettyHttpRequestEncoderTracingHandler.java b/apm-sniffer/optional-plugins/netty-http-4.1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/http/handler/NettyHttpRequestEncoderTracingHandler.java index bb34adbaac..38c8518fb3 100644 --- a/apm-sniffer/optional-plugins/netty-http-4.1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/http/handler/NettyHttpRequestEncoderTracingHandler.java +++ b/apm-sniffer/optional-plugins/netty-http-4.1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/http/handler/NettyHttpRequestEncoderTracingHandler.java @@ -80,7 +80,6 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) InetSocketAddress address = (InetSocketAddress) ctx.channel().remoteAddress(); String peer = address.getHostString() + ":" + address.getPort(); String url = peer + uri; - String method = request.method().toString(); ContextCarrier contextCarrier = new ContextCarrier(); AbstractSpan span = ContextManager.createExitSpan(NettyConstants.NETTY_HTTP_OPERATION_PREFIX + uri, contextCarrier, peer); diff --git a/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml b/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml index a9b9bb25f6..cc26ef8c91 100644 --- a/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml +++ b/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml @@ -90,14 +90,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 21 - 21 - - org.apache.maven.plugins maven-javadoc-plugin From 1b72de900b92c063acf00cbc83b70f33e65c4ac8 Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sun, 26 Oct 2025 17:03:30 +0800 Subject: [PATCH 31/33] Fix --- .../scenarios/spring-kafka-1.3.x-scenario/configuration.yml | 2 +- .../scenarios/spring-kafka-2.2.x-scenario/configuration.yml | 2 +- .../scenarios/spring-kafka-2.3.x-scenario/configuration.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/plugin/scenarios/spring-kafka-1.3.x-scenario/configuration.yml b/test/plugin/scenarios/spring-kafka-1.3.x-scenario/configuration.yml index f608847078..8d387e2d45 100644 --- a/test/plugin/scenarios/spring-kafka-1.3.x-scenario/configuration.yml +++ b/test/plugin/scenarios/spring-kafka-1.3.x-scenario/configuration.yml @@ -28,7 +28,7 @@ dependencies: image: zookeeper:3.4 hostname: zookeeper-server kafka-server: - image: bitnami/kafka:2.1.1 + image: bitnamilegacy/kafka:2.4.1 hostname: kafka-server environment: - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181 diff --git a/test/plugin/scenarios/spring-kafka-2.2.x-scenario/configuration.yml b/test/plugin/scenarios/spring-kafka-2.2.x-scenario/configuration.yml index c8b94d2bee..164b29135a 100644 --- a/test/plugin/scenarios/spring-kafka-2.2.x-scenario/configuration.yml +++ b/test/plugin/scenarios/spring-kafka-2.2.x-scenario/configuration.yml @@ -28,7 +28,7 @@ dependencies: image: zookeeper:3.4 hostname: zookeeper-server kafka-server: - image: bitnami/kafka:2.1.1 + image: bitnamilegacy/kafka:2.4.1 hostname: kafka-server environment: - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181 diff --git a/test/plugin/scenarios/spring-kafka-2.3.x-scenario/configuration.yml b/test/plugin/scenarios/spring-kafka-2.3.x-scenario/configuration.yml index 3d40a52355..295f967541 100644 --- a/test/plugin/scenarios/spring-kafka-2.3.x-scenario/configuration.yml +++ b/test/plugin/scenarios/spring-kafka-2.3.x-scenario/configuration.yml @@ -28,7 +28,7 @@ dependencies: image: zookeeper:3.4 hostname: zookeeper-server kafka-server: - image: bitnami/kafka:2.1.1 + image: bitnamilegacy/kafka:2.4.1 hostname: kafka-server environment: - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181 From b394856274963db1977b4a37a615bb884f1fe27c Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sun, 26 Oct 2025 17:49:10 +0800 Subject: [PATCH 32/33] Fix --- test/e2e/case/kafka/docker-compose.yml | 4 ++-- .../elasticsearch-transport-6.x-scenario/configuration.yml | 2 +- .../jedis-2.x-3.x-cluster-scenario/configuration.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/e2e/case/kafka/docker-compose.yml b/test/e2e/case/kafka/docker-compose.yml index 40bb4ba346..4f25a14cd6 100644 --- a/test/e2e/case/kafka/docker-compose.yml +++ b/test/e2e/case/kafka/docker-compose.yml @@ -32,7 +32,7 @@ services: retries: 120 broker-a: - image: bitnami/kafka:2.4.1 + image: bitnamilegacy/kafka:2.4.1 hostname: broker-a expose: - 9092 @@ -52,7 +52,7 @@ services: retries: 120 broker-b: - image: bitnami/kafka:2.4.1 + image: bitnamilegacy/kafka:2.4.1 hostname: broker-b expose: - 9092 diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml index cafc4a0571..a268b52e4c 100644 --- a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml @@ -20,7 +20,7 @@ environment: - elasticsearch.server=elasticsearch-server-6.x:9200 dependencies: elasticsearch-server-6.x: - image: bitnami/elasticsearch:${CASE_SERVER_IMAGE_VERSION} + image: bitnamilegacy/elasticsearch:${CASE_SERVER_IMAGE_VERSION} hostname: elasticsearch-server-6.x removeOnExit: true expose: diff --git a/test/plugin/scenarios/jedis-2.x-3.x-cluster-scenario/configuration.yml b/test/plugin/scenarios/jedis-2.x-3.x-cluster-scenario/configuration.yml index e37ee9af2f..79a60472da 100644 --- a/test/plugin/scenarios/jedis-2.x-3.x-cluster-scenario/configuration.yml +++ b/test/plugin/scenarios/jedis-2.x-3.x-cluster-scenario/configuration.yml @@ -23,19 +23,19 @@ environment: - SW_PLUGIN_JEDIS_TRACE_REDIS_PARAMETERS=true dependencies: redis-server1: - image: bitnami/redis-cluster:7.0 + image: bitnamilegacy/redis-cluster:7.0 hostname: redis-server1 environment: - ALLOW_EMPTY_PASSWORD=true - REDIS_NODES=redis-server1 redis-server2 redis-server3 redis-server2: - image: bitnami/redis-cluster:7.0 + image: bitnamilegacy/redis-cluster:7.0 hostname: redis-server2 environment: - ALLOW_EMPTY_PASSWORD=true - REDIS_NODES=redis-server1 redis-server2 redis-server3 redis-server3: - image: bitnami/redis-cluster:7.0 + image: bitnamilegacy/redis-cluster:7.0 hostname: redis-server3 depends_on: - redis-server1 From 2a45fe2a988071fe93b224593668ede2068e2b2b Mon Sep 17 00:00:00 2001 From: peachisai <2581009893@qq.com> Date: Sun, 26 Oct 2025 18:29:41 +0800 Subject: [PATCH 33/33] Fix --- test/plugin/scenarios/kafka-scenario/configuration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/scenarios/kafka-scenario/configuration.yml b/test/plugin/scenarios/kafka-scenario/configuration.yml index 5a74c2ba42..7db52f161f 100644 --- a/test/plugin/scenarios/kafka-scenario/configuration.yml +++ b/test/plugin/scenarios/kafka-scenario/configuration.yml @@ -28,7 +28,7 @@ dependencies: image: zookeeper:3.4 hostname: zookeeper-server kafka-server: - image: bitnami/kafka:2.1.1 + image: bitnamilegacy/kafka:2.4.1 hostname: kafka-server environment: - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181