From 80a534b1bbaef6d92d3ceb1f2a6b0382a6964b40 Mon Sep 17 00:00:00 2001
From: caoyixiong <32847163+IanCao@users.noreply.github.com>
Date: Sun, 5 Jul 2020 23:37:09 +0800
Subject: [PATCH] support Graphql Logic endpoint (#5030)
---
.github/workflows/plugins-test.3.yaml | 3 +
.../trace/component/ComponentsDefine.java | 2 +
.../apm/agent/core/context/tag/Tags.java | 2 +
.../graphql-12.x-plugin/pom.xml | 41 ++++++
.../graphql/v12/GraphqlInterceptor.java | 78 +++++++++++
.../v12/define/GraphqlInstrumentation.java | 69 ++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../graphql-plugin/graphql-8.x-plugin/pom.xml | 40 ++++++
.../plugin/graphql/v8/GraphqlInterceptor.java | 109 ++++++++++++++++
.../v8/define/GraphqlInstrumentation.java | 69 ++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../graphql-plugin/graphql-9.x-plugin/pom.xml | 40 ++++++
.../plugin/graphql/v9/GraphqlInterceptor.java | 78 +++++++++++
.../v9/define/GraphqlInstrumentation.java | 69 ++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../apm-sdk-plugin/graphql-plugin/pom.xml | 43 +++++++
apm-sniffer/apm-sdk-plugin/pom.xml | 1 +
.../java-agent/Supported-list.md | 3 +-
.../main/resources/component-libraries.yml | 3 +
.../scenarios/baidu-brpc-scenario/pom.xml | 11 --
test/plugin/scenarios/canal-scenario/pom.xml | 11 --
.../graphql-12.x-scenario/bin/startup.sh | 21 +++
.../config/expectedData.yaml | 92 +++++++++++++
.../graphql-12.x-scenario/configuration.yml | 20 +++
.../scenarios/graphql-12.x-scenario/pom.xml | 115 +++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 120 +++++++++++++++++
.../graphql/controller/CaseController.java | 53 ++++++++
.../apm/testcase/graphql/data/User.java | 26 ++++
.../src/main/resources/application.yml | 20 +++
.../support-version.list | 22 ++++
.../graphql-8.x-scenario/bin/startup.sh | 21 +++
.../config/expectedData.yaml | 92 +++++++++++++
.../graphql-8.x-scenario/configuration.yml | 20 +++
.../scenarios/graphql-8.x-scenario/pom.xml | 114 +++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 121 ++++++++++++++++++
.../testcase/graphql/configuration/User.java | 26 ++++
.../graphql/controller/CaseController.java | 53 ++++++++
.../src/main/resources/application.yml | 20 +++
.../graphql-8.x-scenario/support-version.list | 19 +++
.../graphql-9.x-scenario/bin/startup.sh | 21 +++
.../config/expectedData.yaml | 92 +++++++++++++
.../graphql-9.x-scenario/configuration.yml | 20 +++
.../scenarios/graphql-9.x-scenario/pom.xml | 114 +++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 120 +++++++++++++++++
.../graphql/controller/CaseController.java | 53 ++++++++
.../apm/testcase/graphql/data/User.java | 26 ++++
.../src/main/resources/application.yml | 20 +++
.../graphql-9.x-scenario/support-version.list | 21 +++
54 files changed, 2372 insertions(+), 23 deletions(-)
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def
create mode 100644 apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/configuration.yml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/pom.xml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml
create mode 100644 test/plugin/scenarios/graphql-12.x-scenario/support-version.list
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/pom.xml
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml
create mode 100644 test/plugin/scenarios/graphql-8.x-scenario/support-version.list
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/pom.xml
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml
create mode 100644 test/plugin/scenarios/graphql-9.x-scenario/support-version.list
diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index 54ae76d84..3df8132c6 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -49,6 +49,9 @@ jobs:
- { name: 'baidu-brpc-scenario', title: 'baidu-brpc 2.3.7-2.5.3 (12)' }
- { name: 'retransform-class-scenario', title: 'Retransform class (1)' }
- { name: 'retransform-class-tomcat-scenario', title: 'Retransform class (1)' }
+ - { name: 'graphql-8.x-scenario', title: 'graphql-8.x 8.0 (1)' }
+ - { name: 'graphql-9.x-scenario', title: 'graphql-9.x 9.0-11.0 (3)' }
+ - { name: 'graphql-12.x-scenario', title: 'graphql-12.x 12.0-15.0 (4)' }
steps:
- uses: actions/checkout@v2
with:
diff --git a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
index 14775224b..163371a1b 100755
--- a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
+++ b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
@@ -164,4 +164,6 @@ public class ComponentsDefine {
public static final OfficialComponent INFLUXDB_JAVA = new OfficialComponent(90, "influxdb-java");
public static final OfficialComponent BRPC_JAVA = new OfficialComponent(91, "brpc-java");
+
+ public static final OfficialComponent GRAPHQL = new OfficialComponent(92, "GraphQL");
}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
index 9d36386aa..7ddb592c3 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
@@ -83,6 +83,8 @@ public final class Tags {
public static final StringTag PARAMS = new StringTag(11, "http.params", true);
}
+ public static final StringTag LOGIC_ENDPOINT = new StringTag(12, "x-le");
+
/**
* Creates a {@code StringTag} with the given key and cache it, if it's created before, simply return it without
* creating a new one.
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
new file mode 100644
index 000000000..43a2af4cd
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ graphql-plugin
+ org.apache.skywalking
+ 8.1.0-SNAPSHOT
+
+ 4.0.0
+
+ graphql-12.x-plugin
+
+
+
+ com.graphql-java
+ graphql-java
+ 12.0
+ provided
+
+
+
+
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
new file mode 100644
index 000000000..1533181b5
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
@@ -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.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.graphql.v12;
+
+import graphql.execution.ExecutionPath;
+import graphql.execution.ExecutionStrategyParameters;
+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.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.util.HashMap;
+import java.util.Map;
+
+public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return;
+ }
+ AbstractSpan span = ContextManager.createLocalSpan(parameters.getField().getSingleField().getName());
+ Tags.LOGIC_ENDPOINT.set(span, buildLogicEndpointSpan());
+ span.setComponent(ComponentsDefine.GRAPHQL);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Object ret) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return ret;
+ }
+ ContextManager.stopSpan();
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Throwable t) {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return;
+ }
+ dealException(t);
+ }
+
+ private void dealException(Throwable throwable) {
+ AbstractSpan span = ContextManager.activeSpan();
+ span.errorOccurred();
+ span.log(throwable);
+ }
+
+ private String buildLogicEndpointSpan() {
+ Map logicEndpointSpan = new HashMap<>();
+ logicEndpointSpan.put("logic-span", true);
+ return logicEndpointSpan.toString();
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
new file mode 100644
index 000000000..2e2fdaaf5
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
@@ -0,0 +1,69 @@
+/*
+ * 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.graphql.v12.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+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.NameMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+public class GraphqlInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+ public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.graphql.v12.GraphqlInterceptor";
+ public static final String ENHANCE_CLASS = "graphql.execution.ExecutionStrategy";
+ public static final String ENHANCE_METHOD_DISPATCH = "resolveFieldWithInfo";
+
+ @Override protected ClassMatch enhanceClass() {
+ return NameMatch.byName(ENHANCE_CLASS);
+ }
+
+ @Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[] {
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher getMethodsMatcher() {
+ return named(ENHANCE_METHOD_DISPATCH);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {"graphql.cachecontrol.CacheControl"};
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 000000000..f0f63a34c
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def
@@ -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.
+
+graphql=org.apache.skywalking.apm.plugin.graphql.v12.define.GraphqlInstrumentation
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
new file mode 100644
index 000000000..1f2a3e1e2
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ graphql-plugin
+ org.apache.skywalking
+ 8.1.0-SNAPSHOT
+
+ 4.0.0
+
+ graphql-8.x-plugin
+
+
+
+ com.graphql-java
+ graphql-java
+ 8.0
+ provided
+
+
+
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java
new file mode 100644
index 000000000..4acdf6fe9
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.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.graphql.v8;
+
+import graphql.execution.ExecutionPath;
+import graphql.execution.ExecutionStrategyParameters;
+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.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.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null) {
+ return;
+ }
+ ExecutionPath path = parameters.getPath();
+ try {
+ Field field = ExecutionPath.class.getDeclaredField("parent");
+ field.setAccessible(true);
+ ExecutionPath parentPath = (ExecutionPath) field.get(path);
+ if (parentPath != ExecutionPath.rootPath()) {
+ return;
+ }
+ AbstractSpan span = ContextManager.createLocalSpan(parameters.getField().get(0).getName());
+ Tags.LOGIC_ENDPOINT.set(span, buildLogicEndpointSpan());
+ span.setComponent(ComponentsDefine.GRAPHQL);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ }
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Object ret) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null) {
+ return ret;
+ }
+ ExecutionPath path = parameters.getPath();
+ try {
+ Field field = ExecutionPath.class.getDeclaredField("parent");
+ field.setAccessible(true);
+ ExecutionPath parentPath = (ExecutionPath) field.get(path);
+ if (parentPath != ExecutionPath.rootPath()) {
+ return ret;
+ }
+ ContextManager.stopSpan();
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ }
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Throwable t) {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null) {
+ return;
+ }
+ ExecutionPath path = parameters.getPath();
+ try {
+ Field field = ExecutionPath.class.getDeclaredField("parent");
+ field.setAccessible(true);
+ ExecutionPath parentPath = (ExecutionPath) field.get(path);
+ if (parentPath != ExecutionPath.rootPath()) {
+ return;
+ }
+ dealException(t);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ }
+ }
+
+ private void dealException(Throwable throwable) {
+ AbstractSpan span = ContextManager.activeSpan();
+ span.errorOccurred();
+ span.log(throwable);
+ }
+
+ private String buildLogicEndpointSpan() {
+ Map logicEndpointSpan = new HashMap<>();
+ logicEndpointSpan.put("logic-span", true);
+ return logicEndpointSpan.toString();
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
new file mode 100644
index 000000000..402efcd9a
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
@@ -0,0 +1,69 @@
+/*
+ * 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.graphql.v8.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+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.NameMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+public class GraphqlInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+ public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.graphql.v8.GraphqlInterceptor";
+ public static final String ENHANCE_CLASS = "graphql.execution.ExecutionStrategy";
+ public static final String ENHANCE_METHOD_DISPATCH = "resolveField";
+
+ @Override protected ClassMatch enhanceClass() {
+ return NameMatch.byName(ENHANCE_CLASS);
+ }
+
+ @Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[] {
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher getMethodsMatcher() {
+ return named(ENHANCE_METHOD_DISPATCH);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {"graphql.util.SimpleTraverserContext", "graphql.analysis.FieldVisitor"};
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 000000000..f896362d4
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def
@@ -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.
+
+graphql=org.apache.skywalking.apm.plugin.graphql.v8.define.GraphqlInstrumentation
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
new file mode 100644
index 000000000..bf78010e5
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ graphql-plugin
+ org.apache.skywalking
+ 8.1.0-SNAPSHOT
+
+ 4.0.0
+
+ graphql-9.x-plugin
+
+
+
+ com.graphql-java
+ graphql-java
+ 9.0
+ provided
+
+
+
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
new file mode 100644
index 000000000..0a1f05ff7
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
@@ -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.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.graphql.v9;
+
+import graphql.execution.ExecutionPath;
+import graphql.execution.ExecutionStrategyParameters;
+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.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.util.HashMap;
+import java.util.Map;
+
+public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return;
+ }
+ AbstractSpan span = ContextManager.createLocalSpan(parameters.getField().get(0).getName());
+ Tags.LOGIC_ENDPOINT.set(span, buildLogicEndpointSpan());
+ span.setComponent(ComponentsDefine.GRAPHQL);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Object ret) throws Throwable {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return ret;
+ }
+ ContextManager.stopSpan();
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes, Throwable t) {
+ ExecutionStrategyParameters parameters = (ExecutionStrategyParameters) allArguments[1];
+ if (parameters == null || parameters.getParent().getPath() != ExecutionPath.rootPath()) {
+ return;
+ }
+ dealException(t);
+ }
+
+ private void dealException(Throwable throwable) {
+ AbstractSpan span = ContextManager.activeSpan();
+ span.errorOccurred();
+ span.log(throwable);
+ }
+
+ private String buildLogicEndpointSpan() {
+ Map logicEndpointSpan = new HashMap<>();
+ logicEndpointSpan.put("logic-span", true);
+ return logicEndpointSpan.toString();
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
new file mode 100644
index 000000000..9997fee48
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
@@ -0,0 +1,69 @@
+/*
+ * 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.graphql.v9.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+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.NameMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+public class GraphqlInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+ public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.graphql.v9.GraphqlInterceptor";
+ public static final String ENHANCE_CLASS = "graphql.execution.ExecutionStrategy";
+ public static final String ENHANCE_METHOD_DISPATCH = "resolveFieldWithInfo";
+
+ @Override protected ClassMatch enhanceClass() {
+ return NameMatch.byName(ENHANCE_CLASS);
+ }
+
+ @Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[] {
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher getMethodsMatcher() {
+ return named(ENHANCE_METHOD_DISPATCH);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {"graphql.util.SimpleTraverserContext", "graphql.analysis.QueryVisitor"};
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 000000000..81e23a51f
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def
@@ -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.
+
+graphql=org.apache.skywalking.apm.plugin.graphql.v9.define.GraphqlInstrumentation
diff --git a/apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
new file mode 100644
index 000000000..1f481c2a3
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ apm-sdk-plugin
+ org.apache.skywalking
+ 8.1.0-SNAPSHOT
+
+ 4.0.0
+ pom
+
+ graphql-plugin
+
+
+ graphql-8.x-plugin
+ graphql-9.x-plugin
+ graphql-12.x-plugin
+
+
+
+ UTF-8
+ /..
+
+
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml
index 08a16f681..27f065644 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -94,6 +94,7 @@
mariadb-2.x-plugininfluxdb-2.x-pluginbaidu-brpc-plugin
+ graphql-pluginpom
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 5963d2723..31ebeb9f9 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -95,7 +95,8 @@
* [Ehcache](https://www.ehcache.org/) 2.x
* Kotlin
* [Coroutine](https://kotlinlang.org/docs/reference/coroutines-overview.html) 1.0.1 -> 1.3.x (Optional²)
-
+* GraphQL
+ * [Graphql](https://github.com/graphql-java) 8.0 -> 15.x
¹Due to license incompatibilities/restrictions these plugins are hosted and released in 3rd part repository,
go to [SkyAPM java plugin extension repository](https://github.com/SkyAPM/java-plugin-extensions) to get these.
diff --git a/oap-server/server-bootstrap/src/main/resources/component-libraries.yml b/oap-server/server-bootstrap/src/main/resources/component-libraries.yml
index 9b3d0359c..08b5704d7 100755
--- a/oap-server/server-bootstrap/src/main/resources/component-libraries.yml
+++ b/oap-server/server-bootstrap/src/main/resources/component-libraries.yml
@@ -305,6 +305,9 @@ influxdb-java:
brpc-java:
id: 91
languages: Java
+GraphQL:
+ id: 92
+ languages: Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
diff --git a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml b/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
index 6063462c9..05b296370 100644
--- a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+++ b/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
@@ -105,15 +105,4 @@
-
-
-
- spring-snapshots
- http://repo.spring.io/snapshot
-
-
- spring-milestones
- http://repo.spring.io/milestone
-
-
\ No newline at end of file
diff --git a/test/plugin/scenarios/canal-scenario/pom.xml b/test/plugin/scenarios/canal-scenario/pom.xml
index b48175764..03ee7fe6a 100644
--- a/test/plugin/scenarios/canal-scenario/pom.xml
+++ b/test/plugin/scenarios/canal-scenario/pom.xml
@@ -154,15 +154,4 @@
-
-
-
- spring-snapshots
- http://repo.spring.io/snapshot
-
-
- spring-milestones
- http://repo.spring.io/milestone
-
-
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh b/test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh
new file mode 100644
index 000000000..979ab75db
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-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/graphql-12.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..bd898b31e
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml
@@ -0,0 +1,92 @@
+# 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: graphql-12.x-scenario
+ segmentSize: gt 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: /graphql-scenario/case/graphql
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 1
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8080/graphql-scenario/case/graphql'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/configuration.yml b/test/plugin/scenarios/graphql-12.x-scenario/configuration.yml
new file mode 100644
index 000000000..9032d2abf
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/configuration.yml
@@ -0,0 +1,20 @@
+# 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/graphql-scenario/case/graphql
+healthCheck: http://localhost:8080/graphql-scenario/case/healthCheck
+startScript: ./bin/startup.sh
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/pom.xml b/test/plugin/scenarios/graphql-12.x-scenario/pom.xml
new file mode 100644
index 000000000..77ced6c07
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/pom.xml
@@ -0,0 +1,115 @@
+
+
+
+
+ org.apache.skywalking.apm.testcase
+ graphql-12.x-scenario
+ 1.0.0
+ jar
+
+ 4.0.0
+
+ skywalking-graphql-12.x-scenario
+
+
+ UTF-8
+ 1.8
+ 2.1.6.RELEASE
+ 9.0
+ 1.18.10
+ graphql
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.graphql-java
+ graphql-java
+ ${test.framework.version}
+ provided
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ graphql-12.x-scenario
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ./target/
+
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..2dde7cc7c
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/graphql-12.x-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
new file mode 100644
index 000000000..657ca4598
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
@@ -0,0 +1,29 @@
+/*
+ * 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.testcase.graphql;
+
+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/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
new file mode 100644
index 000000000..b9ebeadda
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
@@ -0,0 +1,120 @@
+/*
+ * 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.testcase.graphql.configuration;
+
+import graphql.GraphQL;
+import graphql.schema.GraphQLFieldDefinition;
+import graphql.schema.GraphQLList;
+import graphql.schema.GraphQLOutputType;
+import graphql.schema.GraphQLSchema;
+import org.apache.skywalking.apm.testcase.graphql.data.User;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+
+import static graphql.Scalars.GraphQLInt;
+import static graphql.Scalars.GraphQLString;
+import static graphql.schema.GraphQLArgument.newArgument;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
+import static graphql.schema.GraphQLObjectType.newObject;
+
+@Component
+public class GraphSchema {
+ private graphql.schema.GraphQLSchema schema;
+ private GraphQLOutputType userType;
+
+ @PostConstruct
+ public void init() {
+ initOutputType();
+ schema = graphql.schema.GraphQLSchema.newSchema().query(newObject()
+ .name("GraphQuery")
+ .field(createUsersField())
+ .field(createUserField())
+ .build()).build();
+ }
+
+ @Bean
+ public GraphQL graphQL() {
+ return new GraphQL(getSchema());
+ }
+
+ private void initOutputType() {
+
+ userType = newObject()
+ .name("User")
+ .field(newFieldDefinition().name("id").type(GraphQLInt).build())
+ .field(newFieldDefinition().name("name").type(GraphQLString).build())
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUserField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("user")
+ .argument(newArgument().name("id").type(GraphQLInt).build())
+ .type(userType)
+ .dataFetcher(environment -> {
+ int id = environment.getArgument("id");
+ try {
+ Thread.sleep(300L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ User user = new User();
+ user.setId(id);
+ user.setName("Name_" + id);
+ return user;
+ })
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUsersField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("users")
+ .argument(newArgument().name("page").type(GraphQLInt).build())
+ .argument(newArgument().name("size").type(GraphQLInt).build())
+ .argument(newArgument().name("name").type(GraphQLString).build())
+ .type(new GraphQLList(userType))
+ .dataFetcher(environment -> {
+ int page = environment.getArgument("page");
+ int size = environment.getArgument("size");
+ String name = environment.getArgument("name");
+
+ try {
+ Thread.sleep(100L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ List list = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+ User user = new User();
+ user.setId(i);
+ user.setName(name + "_" + page + "_" + i);
+ list.add(user);
+ }
+ return list;
+ })
+ .build();
+ }
+
+ public GraphQLSchema getSchema() {
+ return schema;
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
new file mode 100644
index 000000000..40f966aa3
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.testcase.graphql.controller;
+
+import graphql.ExecutionInput;
+import graphql.GraphQL;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ private static final String SUCCESS = "Success";
+
+ @Resource
+ private GraphQL graphQL;
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() {
+ return SUCCESS;
+ }
+
+ @RequestMapping("/graphql")
+ @ResponseBody
+ public String graphql() {
+ String query3 = "{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}";
+ ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(query3).build();
+ graphQL.execute(executionInput);
+ graphQL.executeAsync(executionInput);
+ return SUCCESS;
+ }
+}
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
new file mode 100644
index 000000000..c23a2baf3
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
@@ -0,0 +1,26 @@
+/*
+ * 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.testcase.graphql.data;
+
+import lombok.Data;
+
+@Data
+public class User {
+ private int id;
+ private String name;
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml b/test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml
new file mode 100644
index 000000000..3d9f580c4
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml
@@ -0,0 +1,20 @@
+# 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: /graphql-scenario
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-12.x-scenario/support-version.list b/test/plugin/scenarios/graphql-12.x-scenario/support-version.list
new file mode 100644
index 000000000..12b708fce
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/support-version.list
@@ -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
+# "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.
+
+# lists your version here
+
+12.0
+13.0
+14.0
+15.0
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh b/test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh
new file mode 100644
index 000000000..363548466
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-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/graphql-8.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..e8c461c0e
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml
@@ -0,0 +1,92 @@
+# 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: graphql-8.x-scenario
+ segmentSize: gt 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: /graphql-scenario/case/graphql
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 1
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8080/graphql-scenario/case/graphql'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/configuration.yml b/test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
new file mode 100644
index 000000000..9032d2abf
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
@@ -0,0 +1,20 @@
+# 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/graphql-scenario/case/graphql
+healthCheck: http://localhost:8080/graphql-scenario/case/healthCheck
+startScript: ./bin/startup.sh
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/pom.xml b/test/plugin/scenarios/graphql-8.x-scenario/pom.xml
new file mode 100644
index 000000000..59412f081
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/pom.xml
@@ -0,0 +1,114 @@
+
+
+
+
+ org.apache.skywalking.apm.testcase
+ graphql-8.x-scenario
+ 1.0.0
+ jar
+
+ 4.0.0
+
+ skywalking-graphql-8.x-scenario
+
+
+ UTF-8
+ 1.8
+ 2.1.6.RELEASE
+ 8.0
+ 1.18.10
+ graphql
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.graphql-java
+ graphql-java
+ ${test.framework.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ graphql-8.x-scenario
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ./target/
+
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..ead18b015
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/graphql-8.x-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
new file mode 100644
index 000000000..657ca4598
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
@@ -0,0 +1,29 @@
+/*
+ * 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.testcase.graphql;
+
+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/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
new file mode 100644
index 000000000..f960cd0d2
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
@@ -0,0 +1,121 @@
+/*
+ * 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.testcase.graphql.configuration;
+
+import graphql.GraphQL;
+import graphql.schema.GraphQLFieldDefinition;
+import graphql.schema.GraphQLList;
+import graphql.schema.GraphQLOutputType;
+import graphql.schema.GraphQLSchema;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+
+import static graphql.Scalars.GraphQLInt;
+import static graphql.Scalars.GraphQLString;
+import static graphql.schema.GraphQLArgument.newArgument;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
+import static graphql.schema.GraphQLObjectType.newObject;
+
+@Component
+public class GraphSchema {
+ private graphql.schema.GraphQLSchema schema;
+ private GraphQLOutputType userType;
+
+ @PostConstruct
+ public void init() {
+ initOutputType();
+ schema = graphql.schema.GraphQLSchema.newSchema().query(newObject()
+ .name("GraphQuery")
+ .field(createUsersField())
+ .field(createUserField())
+ .build()).build();
+ }
+
+
+ @Bean
+ public GraphQL graphQL() {
+ return new GraphQL(getSchema());
+ }
+
+
+ private void initOutputType() {
+
+ userType = newObject()
+ .name("User")
+ .field(newFieldDefinition().name("id").type(GraphQLInt).build())
+ .field(newFieldDefinition().name("name").type(GraphQLString).build())
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUserField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("user")
+ .argument(newArgument().name("id").type(GraphQLInt).build())
+ .type(userType)
+ .dataFetcher(environment -> {
+ int id = environment.getArgument("id");
+ try {
+ Thread.sleep(300L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ User user = new User();
+ user.setId(id);
+ user.setName("Name_" + id);
+ return user;
+ })
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUsersField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("users")
+ .argument(newArgument().name("page").type(GraphQLInt).build())
+ .argument(newArgument().name("size").type(GraphQLInt).build())
+ .argument(newArgument().name("name").type(GraphQLString).build())
+ .type(new GraphQLList(userType))
+ .dataFetcher(environment -> {
+ int page = environment.getArgument("page");
+ int size = environment.getArgument("size");
+ String name = environment.getArgument("name");
+
+ try {
+ Thread.sleep(100L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ List list = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+ User user = new User();
+ user.setId(i);
+ user.setName(name + "_" + page + "_" + i);
+ list.add(user);
+ }
+ return list;
+ })
+ .build();
+ }
+
+ public GraphQLSchema getSchema() {
+ return schema;
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java
new file mode 100644
index 000000000..d77c76d21
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java
@@ -0,0 +1,26 @@
+/*
+ * 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.testcase.graphql.configuration;
+
+import lombok.Data;
+
+@Data
+public class User {
+ private int id;
+ private String name;
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
new file mode 100644
index 000000000..40f966aa3
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.testcase.graphql.controller;
+
+import graphql.ExecutionInput;
+import graphql.GraphQL;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ private static final String SUCCESS = "Success";
+
+ @Resource
+ private GraphQL graphQL;
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() {
+ return SUCCESS;
+ }
+
+ @RequestMapping("/graphql")
+ @ResponseBody
+ public String graphql() {
+ String query3 = "{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}";
+ ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(query3).build();
+ graphQL.execute(executionInput);
+ graphQL.executeAsync(executionInput);
+ return SUCCESS;
+ }
+}
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml b/test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml
new file mode 100644
index 000000000..3d9f580c4
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml
@@ -0,0 +1,20 @@
+# 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: /graphql-scenario
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-8.x-scenario/support-version.list b/test/plugin/scenarios/graphql-8.x-scenario/support-version.list
new file mode 100644
index 000000000..e5bbb29a4
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/support-version.list
@@ -0,0 +1,19 @@
+# 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
+# "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.
+
+# lists your version here
+
+8.0
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh b/test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh
new file mode 100644
index 000000000..4f9535a84
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-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/graphql-9.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..1d679e409
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml
@@ -0,0 +1,92 @@
+# 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: graphql-9.x-scenario
+ segmentSize: gt 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: user
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: users
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 92
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: x-le, value: '{logic-span=true}'}
+ - operationName: /graphql-scenario/case/graphql
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 1
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8080/graphql-scenario/case/graphql'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/configuration.yml b/test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
new file mode 100644
index 000000000..9032d2abf
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
@@ -0,0 +1,20 @@
+# 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/graphql-scenario/case/graphql
+healthCheck: http://localhost:8080/graphql-scenario/case/healthCheck
+startScript: ./bin/startup.sh
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/pom.xml b/test/plugin/scenarios/graphql-9.x-scenario/pom.xml
new file mode 100644
index 000000000..4ce1b1eb4
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/pom.xml
@@ -0,0 +1,114 @@
+
+
+
+
+ org.apache.skywalking.apm.testcase
+ graphql-9.x-scenario
+ 1.0.0
+ jar
+
+ 4.0.0
+
+ skywalking-graphql-9.x-scenario
+
+
+ UTF-8
+ 1.8
+ 2.1.6.RELEASE
+ 9.0
+ 1.18.10
+ graphql
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot.version}
+ pom
+ import
+
+
+
+
+
+
+ com.graphql-java
+ graphql-java
+ ${test.framework.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ graphql-9.x-scenario
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ./target/
+
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..7a8dbc0dc
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/graphql-9.x-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
new file mode 100644
index 000000000..657ca4598
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
@@ -0,0 +1,29 @@
+/*
+ * 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.testcase.graphql;
+
+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/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
new file mode 100644
index 000000000..b9ebeadda
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
@@ -0,0 +1,120 @@
+/*
+ * 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.testcase.graphql.configuration;
+
+import graphql.GraphQL;
+import graphql.schema.GraphQLFieldDefinition;
+import graphql.schema.GraphQLList;
+import graphql.schema.GraphQLOutputType;
+import graphql.schema.GraphQLSchema;
+import org.apache.skywalking.apm.testcase.graphql.data.User;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+
+import static graphql.Scalars.GraphQLInt;
+import static graphql.Scalars.GraphQLString;
+import static graphql.schema.GraphQLArgument.newArgument;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
+import static graphql.schema.GraphQLObjectType.newObject;
+
+@Component
+public class GraphSchema {
+ private graphql.schema.GraphQLSchema schema;
+ private GraphQLOutputType userType;
+
+ @PostConstruct
+ public void init() {
+ initOutputType();
+ schema = graphql.schema.GraphQLSchema.newSchema().query(newObject()
+ .name("GraphQuery")
+ .field(createUsersField())
+ .field(createUserField())
+ .build()).build();
+ }
+
+ @Bean
+ public GraphQL graphQL() {
+ return new GraphQL(getSchema());
+ }
+
+ private void initOutputType() {
+
+ userType = newObject()
+ .name("User")
+ .field(newFieldDefinition().name("id").type(GraphQLInt).build())
+ .field(newFieldDefinition().name("name").type(GraphQLString).build())
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUserField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("user")
+ .argument(newArgument().name("id").type(GraphQLInt).build())
+ .type(userType)
+ .dataFetcher(environment -> {
+ int id = environment.getArgument("id");
+ try {
+ Thread.sleep(300L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ User user = new User();
+ user.setId(id);
+ user.setName("Name_" + id);
+ return user;
+ })
+ .build();
+ }
+
+ private GraphQLFieldDefinition createUsersField() {
+ return GraphQLFieldDefinition.newFieldDefinition()
+ .name("users")
+ .argument(newArgument().name("page").type(GraphQLInt).build())
+ .argument(newArgument().name("size").type(GraphQLInt).build())
+ .argument(newArgument().name("name").type(GraphQLString).build())
+ .type(new GraphQLList(userType))
+ .dataFetcher(environment -> {
+ int page = environment.getArgument("page");
+ int size = environment.getArgument("size");
+ String name = environment.getArgument("name");
+
+ try {
+ Thread.sleep(100L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ List list = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+ User user = new User();
+ user.setId(i);
+ user.setName(name + "_" + page + "_" + i);
+ list.add(user);
+ }
+ return list;
+ })
+ .build();
+ }
+
+ public GraphQLSchema getSchema() {
+ return schema;
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
new file mode 100644
index 000000000..40f966aa3
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.testcase.graphql.controller;
+
+import graphql.ExecutionInput;
+import graphql.GraphQL;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ private static final String SUCCESS = "Success";
+
+ @Resource
+ private GraphQL graphQL;
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() {
+ return SUCCESS;
+ }
+
+ @RequestMapping("/graphql")
+ @ResponseBody
+ public String graphql() {
+ String query3 = "{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}";
+ ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(query3).build();
+ graphQL.execute(executionInput);
+ graphQL.executeAsync(executionInput);
+ return SUCCESS;
+ }
+}
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
new file mode 100644
index 000000000..c23a2baf3
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
@@ -0,0 +1,26 @@
+/*
+ * 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.testcase.graphql.data;
+
+import lombok.Data;
+
+@Data
+public class User {
+ private int id;
+ private String name;
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml b/test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml
new file mode 100644
index 000000000..3d9f580c4
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml
@@ -0,0 +1,20 @@
+# 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: /graphql-scenario
\ No newline at end of file
diff --git a/test/plugin/scenarios/graphql-9.x-scenario/support-version.list b/test/plugin/scenarios/graphql-9.x-scenario/support-version.list
new file mode 100644
index 000000000..77ff080d8
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/support-version.list
@@ -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
+# "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.
+
+# lists your version here
+
+9.0
+10.0
+11.0
\ No newline at end of file