This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push:
new e43a802733 Add the JDK 11+ httpclient plugin (#778)
e43a802733 is described below
commit e43a80273310352ca480fb5487f767fa73119be9
Author: peachisai <[email protected]>
AuthorDate: Sun Nov 2 23:18:09 2025 +0800
Add the JDK 11+ httpclient plugin (#778)
---
.github/workflows/plugins-jdk11-test.3.yaml | 1 +
CHANGES.md | 1 +
.../jdk-httpclient-plugin/pom.xml | 46 ++++++++
.../apm/plugin/HttpClientSendAsyncInterceptor.java | 123 +++++++++++++++++++++
.../apm/plugin/HttpClientSendInterceptor.java | 108 ++++++++++++++++++
.../apm/plugin/HttpRequestHeadersInterceptor.java | 62 +++++++++++
.../plugin/define/HttpClientInstrumentation.java | 109 ++++++++++++++++++
.../plugin/define/HttpRequestInstrumentation.java | 75 +++++++++++++
.../src/main/resources/skywalking-plugin.def | 25 +----
apm-sniffer/bootstrap-plugins/pom.xml | 1 +
.../NettyHttpRequestEncoderTracingHandler.java | 1 -
.../service-agent/java-agent/Bootstrap-plugins.md | 1 +
.../setup/service-agent/java-agent/Plugin-list.md | 1 +
test/e2e/case/kafka/docker-compose.yml | 4 +-
.../configuration.yml | 2 +-
.../bin/startup.sh} | 28 +----
.../config/expectedData.yaml | 111 +++++++++++++++++++
.../configuration.yml | 25 +----
.../pom.xml | 22 ++--
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/jdk/httpclient/Application.java | 30 +++++
.../jdk/httpclient/controller/CaseController.java | 71 ++++++++++++
.../jdk/httpclient/controller/UserController.java | 45 ++++++++
.../testcase/jdk/httpclient/dto/UserLoginDTO.java | 40 +++++++
.../src/main/resources/application.yaml} | 28 +----
.../support-version.list} | 24 +---
.../jdk-virtual-thread-executor-scenario/pom.xml | 8 --
.../configuration.yml | 6 +-
.../scenarios/kafka-scenario/configuration.yml | 2 +-
.../spring-kafka-1.3.x-scenario/configuration.yml | 2 +-
.../spring-kafka-2.2.x-scenario/configuration.yml | 2 +-
.../spring-kafka-2.3.x-scenario/configuration.yml | 2 +-
32 files changed, 900 insertions(+), 147 deletions(-)
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/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/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..88a0f72a99
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/pom.xml
@@ -0,0 +1,46 @@
+<!--
+ ~ 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.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>bootstrap-plugins</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>9.6.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apm-jdk-httpclient-plugin</artifactId>
+ <packaging>jar</packaging>
+
+ <name>apm-jdk-httpclient-plugin</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.release>11</maven.compiler.release>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
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..0661c4705f
--- /dev/null
+++
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendAsyncInterceptor.java
@@ -0,0 +1,123 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+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;
+ ret = future.whenComplete((response, throwable) -> {
+ try {
+ if (throwable != null) {
+ span.errorOccurred();
+ span.log(throwable);
+ return;
+ }
+ 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 {
+ Map<String, String> eventMap = new HashMap<String, String>();
+ eventMap.put("error", "No response");
+ span.log(System.currentTimeMillis(), eventMap);
+ 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
new file mode 100644
index 0000000000..3a06f59ad9
--- /dev/null
+++
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java
@@ -0,0 +1,108 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+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()) {
+ 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 {
+ Map<String, String> eventMap = new HashMap<String, String>();
+ eventMap.put("error", "No response");
+ span.log(System.currentTimeMillis(), eventMap);
+ 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/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<String, List<String>> 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..18f7cf298b
--- /dev/null
+++
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpClientInstrumentation.java
@@ -0,0 +1,109 @@
+/*
+ * 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_ASYNC_METHOD = "sendAsync";
+
+ 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() {
+ 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<MethodDescription>
getMethodsMatcher() {
+ return ElementMatchers.named(INTERCEPT_SEND_METHOD)
+ .and(ElementMatchers.takesArgument(0,
named("java.net.http.HttpRequest")))
+ .and(ElementMatchers.takesArguments(2));
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPT_SEND_HANDLE;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ },
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
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_ASYNC_HANDLE;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ },
+ };
+ }
+}
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..18d47b6923
--- /dev/null
+++
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java
@@ -0,0 +1,75 @@
+/*
+ * 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 static
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+public class HttpRequestInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+
+ private static final String ENHANCE_CLASS =
"jdk.internal.net.http.ImmutableHttpRequest";
+
+ 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 byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
{
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
getMethodsMatcher() {
+ return ElementMatchers.named(INTERCEPT_HEADERS_METHOD);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPT_HEADERS_HANDLE;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return true;
+ }
+ }
+ };
+ }
+}
diff --git a/test/plugin/scenarios/kafka-scenario/configuration.yml
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def
similarity index 54%
copy from test/plugin/scenarios/kafka-scenario/configuration.yml
copy to
apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def
index 5a74c2ba42..e4d1ef2562 100644
--- a/test/plugin/scenarios/kafka-scenario/configuration.yml
+++
b/apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/resources/skywalking-plugin.def
@@ -14,26 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: jvm
-entryService: http://localhost:8080/kafka-scenario/case/kafka-case
-healthCheck: http://localhost:8080/kafka-scenario/case/healthCheck
-startScript: ./bin/startup.sh
-environment:
- - BOOTSTRAP_SERVERS=kafka-server:9092
-depends_on:
- - zookeeper-server
- - kafka-server
-dependencies:
- zookeeper-server:
- image: zookeeper:3.4
- hostname: zookeeper-server
- kafka-server:
- image: bitnami/kafka:2.1.1
- hostname: kafka-server
- environment:
- - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181
- - KAFKA_BROKER_ID=1
- - ALLOW_PLAINTEXT_LISTENER=yes
- - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
- depends_on:
- - zookeeper-server
+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 @@
<module>jdk-threadpool-plugin</module>
<module>jdk-forkjoinpool-plugin</module>
<module>jdk-virtual-thread-executor-plugin</module>
+ <module>jdk-httpclient-plugin</module>
</modules>
<dependencies>
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 class NettyHttpRequestEncoderTracingHandler extends
ChannelOutboundHandle
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/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:
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/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/kafka-scenario/configuration.yml
b/test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh
similarity index 54%
copy from test/plugin/scenarios/kafka-scenario/configuration.yml
copy to test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh
index 5a74c2ba42..6c3e9e8b21 100644
--- a/test/plugin/scenarios/kafka-scenario/configuration.yml
+++ b/test/plugin/scenarios/jdk-httpclient-scenario/bin/startup.sh
@@ -1,3 +1,5 @@
+#!/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
@@ -14,26 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: jvm
-entryService: http://localhost:8080/kafka-scenario/case/kafka-case
-healthCheck: http://localhost:8080/kafka-scenario/case/healthCheck
-startScript: ./bin/startup.sh
-environment:
- - BOOTSTRAP_SERVERS=kafka-server:9092
-depends_on:
- - zookeeper-server
- - kafka-server
-dependencies:
- zookeeper-server:
- image: zookeeper:3.4
- hostname: zookeeper-server
- kafka-server:
- image: bitnami/kafka:2.1.1
- hostname: kafka-server
- environment:
- - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181
- - KAFKA_BROKER_ID=1
- - ALLOW_PLAINTEXT_LISTENER=yes
- - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
- depends_on:
- - zookeeper-server
+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..f009e03a46
--- /dev/null
+++ b/test/plugin/scenarios/jdk-httpclient-scenario/config/expectedData.yaml
@@ -0,0 +1,111 @@
+# 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: 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:/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: 2, 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 }
+ - { key: http.status_code, value: '200' }
+
+ - 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 }
+ - { key: http.status_code, value: '200' }
+
+ - 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:
http://localhost:8080/jdk-httpclient-scenario/case/jdk-httpclient-scenario-case
}
+ - { key: http.method, value: GET }
+ - { key: http.status_code, value: '200' }
+ skipAnalysis: 'false'
diff --git a/test/plugin/scenarios/kafka-scenario/configuration.yml
b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml
similarity index 56%
copy from test/plugin/scenarios/kafka-scenario/configuration.yml
copy to test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml
index 5a74c2ba42..a5fe9c2cb1 100644
--- a/test/plugin/scenarios/kafka-scenario/configuration.yml
+++ b/test/plugin/scenarios/jdk-httpclient-scenario/configuration.yml
@@ -15,25 +15,8 @@
# limitations under the License.
type: jvm
-entryService: http://localhost:8080/kafka-scenario/case/kafka-case
-healthCheck: http://localhost:8080/kafka-scenario/case/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
-environment:
- - BOOTSTRAP_SERVERS=kafka-server:9092
-depends_on:
- - zookeeper-server
- - kafka-server
-dependencies:
- zookeeper-server:
- image: zookeeper:3.4
- hostname: zookeeper-server
- kafka-server:
- image: bitnami/kafka:2.1.1
- hostname: kafka-server
- environment:
- - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181
- - KAFKA_BROKER_ID=1
- - ALLOW_PLAINTEXT_LISTENER=yes
- - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
- depends_on:
- - zookeeper-server
diff --git a/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml
b/test/plugin/scenarios/jdk-httpclient-scenario/pom.xml
similarity index 87%
copy from test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml
copy to test/plugin/scenarios/jdk-httpclient-scenario/pom.xml
index a9b9bb25f6..406bb8f57d 100644
--- a/test/plugin/scenarios/jdk-virtual-thread-executor-scenario/pom.xml
+++ b/test/plugin/scenarios/jdk-httpclient-scenario/pom.xml
@@ -21,17 +21,17 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
- <artifactId>jdk-virtual-thread-executor-scenario</artifactId>
+ <artifactId>jdk-httpclient-scenario</artifactId>
<version>5.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <compiler.version>21</compiler.version>
+ <compiler.version>11</compiler.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<spring.boot.version>2.7.15</spring.boot.version>
</properties>
- <name>skywalking-jdk-virtual-thread-executor-scenario</name>
+ <name>skywalking-jdk-httpclient-scenario</name>
<dependencies>
<dependency>
@@ -41,14 +41,14 @@
</dependency>
<dependency>
- <groupId>org.redisson</groupId>
- <artifactId>redisson</artifactId>
- <version>3.33.0</version>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>1.2.83</version>
</dependency>
</dependencies>
<build>
- <finalName>jdk-virtual-thread-executor-scenario</finalName>
+ <finalName>jdk-httpclient-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@@ -90,14 +90,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>21</source>
- <target>21</target>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ ~
+ -->
+<assembly
+
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>./target/jdk-httpclient-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
\ 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..25d4f4e6b9
--- /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,71 @@
+/*
+ * 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;
+import java.util.concurrent.CompletableFuture;
+
+@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();
+
+ client.send(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<HttpResponse<String>> future =
client.sendAsync(asyncRequest, 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
new file mode 100644
index 0000000000..a9665ffcb6
--- /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,45 @@
+/*
+ * 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;
+ }
+
+ @PostMapping("/asyncLogin")
+ public JSONObject asyncLogin(@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/kafka-scenario/configuration.yml
b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml
similarity index 54%
copy from test/plugin/scenarios/kafka-scenario/configuration.yml
copy to
test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml
index 5a74c2ba42..2bed23f8ca 100644
--- a/test/plugin/scenarios/kafka-scenario/configuration.yml
+++
b/test/plugin/scenarios/jdk-httpclient-scenario/src/main/resources/application.yaml
@@ -14,26 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: jvm
-entryService: http://localhost:8080/kafka-scenario/case/kafka-case
-healthCheck: http://localhost:8080/kafka-scenario/case/healthCheck
-startScript: ./bin/startup.sh
-environment:
- - BOOTSTRAP_SERVERS=kafka-server:9092
-depends_on:
- - zookeeper-server
- - kafka-server
-dependencies:
- zookeeper-server:
- image: zookeeper:3.4
- hostname: zookeeper-server
- kafka-server:
- image: bitnami/kafka:2.1.1
- hostname: kafka-server
- environment:
- - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181
- - KAFKA_BROKER_ID=1
- - ALLOW_PLAINTEXT_LISTENER=yes
- - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
- depends_on:
- - zookeeper-server
+server:
+ port: 8080
+ servlet:
+ context-path: /jdk-httpclient-scenario
+
diff --git a/test/plugin/scenarios/kafka-scenario/configuration.yml
b/test/plugin/scenarios/jdk-httpclient-scenario/support-version.list
similarity index 54%
copy from test/plugin/scenarios/kafka-scenario/configuration.yml
copy to test/plugin/scenarios/jdk-httpclient-scenario/support-version.list
index 5a74c2ba42..feef03cdea 100644
--- a/test/plugin/scenarios/kafka-scenario/configuration.yml
+++ b/test/plugin/scenarios/jdk-httpclient-scenario/support-version.list
@@ -14,26 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: jvm
-entryService: http://localhost:8080/kafka-scenario/case/kafka-case
-healthCheck: http://localhost:8080/kafka-scenario/case/healthCheck
-startScript: ./bin/startup.sh
-environment:
- - BOOTSTRAP_SERVERS=kafka-server:9092
-depends_on:
- - zookeeper-server
- - kafka-server
-dependencies:
- zookeeper-server:
- image: zookeeper:3.4
- hostname: zookeeper-server
- kafka-server:
- image: bitnami/kafka:2.1.1
- hostname: kafka-server
- environment:
- - KAFKA_ZOOKEEPER_CONNECT=zookeeper-server:2181
- - KAFKA_BROKER_ID=1
- - ALLOW_PLAINTEXT_LISTENER=yes
- - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
- depends_on:
- - zookeeper-server
+all
\ No newline at end of file
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 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>21</source>
- <target>21</target>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
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
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
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