You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/07/05 15:37:26 UTC
[skywalking] branch master updated: support Graphql Logic endpoint
(#5030)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 80a534b support Graphql Logic endpoint (#5030)
80a534b is described below
commit 80a534b1bbaef6d92d3ceb1f2a6b0382a6964b40
Author: caoyixiong <32...@users.noreply.github.com>
AuthorDate: Sun Jul 5 23:37:09 2020 +0800
support Graphql Logic endpoint (#5030)
---
.github/workflows/plugins-test.3.yaml | 3 +
.../network/trace/component/ComponentsDefine.java | 2 +
.../apm/agent/core/context/tag/Tags.java | 2 +
.../graphql-plugin/graphql-12.x-plugin/pom.xml | 41 +++++++
.../apm/plugin/graphql/v12/GraphqlInterceptor.java | 78 +++++++++++++
.../graphql/v12/define/GraphqlInstrumentation.java | 69 ++++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../graphql-plugin/graphql-8.x-plugin/pom.xml | 40 +++++++
.../apm/plugin/graphql/v8/GraphqlInterceptor.java | 109 +++++++++++++++++++
.../graphql/v8/define/GraphqlInstrumentation.java | 69 ++++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../graphql-plugin/graphql-9.x-plugin/pom.xml | 40 +++++++
.../apm/plugin/graphql/v9/GraphqlInterceptor.java | 78 +++++++++++++
.../graphql/v9/define/GraphqlInstrumentation.java | 69 ++++++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml | 43 ++++++++
apm-sniffer/apm-sdk-plugin/pom.xml | 1 +
.../service-agent/java-agent/Supported-list.md | 3 +-
.../src/main/resources/component-libraries.yml | 3 +
test/plugin/scenarios/baidu-brpc-scenario/pom.xml | 11 --
test/plugin/scenarios/canal-scenario/pom.xml | 11 --
.../scenarios/graphql-12.x-scenario/bin/startup.sh | 21 ++++
.../graphql-12.x-scenario/config/expectedData.yaml | 92 ++++++++++++++++
.../graphql-12.x-scenario/configuration.yml | 20 ++++
.../pom.xml | 46 ++++----
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 120 ++++++++++++++++++++
.../graphql/controller/CaseController.java | 53 +++++++++
.../skywalking/apm/testcase/graphql/data/User.java | 26 +++++
.../src/main/resources/application.yml | 20 ++++
.../graphql-12.x-scenario/support-version.list | 22 ++++
.../scenarios/graphql-8.x-scenario/bin/startup.sh | 21 ++++
.../graphql-8.x-scenario/config/expectedData.yaml | 92 ++++++++++++++++
.../graphql-8.x-scenario/configuration.yml | 20 ++++
.../pom.xml | 45 ++++----
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 121 +++++++++++++++++++++
.../apm/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 ++++
.../scenarios/graphql-9.x-scenario/bin/startup.sh | 21 ++++
.../graphql-9.x-scenario/config/expectedData.yaml | 92 ++++++++++++++++
.../graphql-9.x-scenario/configuration.yml | 20 ++++
.../pom.xml | 45 ++++----
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/graphql/Application.java | 29 +++++
.../graphql/configuration/GraphSchema.java | 120 ++++++++++++++++++++
.../graphql/controller/CaseController.java | 53 +++++++++
.../skywalking/apm/testcase/graphql/data/User.java | 26 +++++
.../src/main/resources/application.yml | 20 ++++
.../graphql-9.x-scenario/support-version.list | 21 ++++
54 files changed, 2090 insertions(+), 98 deletions(-)
diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index 54ae76d..3df8132 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 1477522..163371a 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 9d36386..7ddb592 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 0000000..43a2af4
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>graphql-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>graphql-12.x-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
+ <version>12.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ 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 0000000..1533181
--- /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<String, Object> 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 0000000..2e2fdaa
--- /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<MethodDescription> 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 0000000..f0f63a3
--- /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 0000000..1f2a3e1
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>graphql-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>graphql-8.x-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
+ <version>8.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ 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 0000000..4acdf6f
--- /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<String, Object> 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 0000000..402efcd
--- /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<MethodDescription> 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 0000000..f896362
--- /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 0000000..bf78010
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>graphql-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>graphql-9.x-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
+ <version>9.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ 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 0000000..0a1f05f
--- /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<String, Object> 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 0000000..9997fee
--- /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<MethodDescription> 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 0000000..81e23a5
--- /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 0000000..1f481c2
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apm-sdk-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+
+ <artifactId>graphql-plugin</artifactId>
+
+ <modules>
+ <module>graphql-8.x-plugin</module>
+ <module>graphql-9.x-plugin</module>
+ <module>graphql-12.x-plugin</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <sdk.plugin.related.dir>/..</sdk.plugin.related.dir>
+ </properties>
+</project>
\ 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 08a16f6..27f0656 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -94,6 +94,7 @@
<module>mariadb-2.x-plugin</module>
<module>influxdb-2.x-plugin</module>
<module>baidu-brpc-plugin</module>
+ <module>graphql-plugin</module>
</modules>
<packaging>pom</packaging>
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 5963d27..31ebeb9 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 9b3d035..08b5704 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 6063462..05b2963 100644
--- a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+++ b/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
@@ -105,15 +105,4 @@
</plugin>
</plugins>
</build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <url>http://repo.spring.io/snapshot</url>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <url>http://repo.spring.io/milestone</url>
- </pluginRepository>
- </pluginRepositories>
</project>
\ 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 b481757..03ee7fe 100644
--- a/test/plugin/scenarios/canal-scenario/pom.xml
+++ b/test/plugin/scenarios/canal-scenario/pom.xml
@@ -154,15 +154,4 @@
</plugin>
</plugins>
</build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <url>http://repo.spring.io/snapshot</url>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <url>http://repo.spring.io/milestone</url>
- </pluginRepository>
- </pluginRepositories>
</project>
\ 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 0000000..979ab75
--- /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 0000000..bd898b3
--- /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 0000000..9032d2a
--- /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/baidu-brpc-scenario/pom.xml b/test/plugin/scenarios/graphql-12.x-scenario/pom.xml
similarity index 82%
copy from test/plugin/scenarios/baidu-brpc-scenario/pom.xml
copy to test/plugin/scenarios/graphql-12.x-scenario/pom.xml
index 6063462..77ced6c 100644
--- a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+++ b/test/plugin/scenarios/graphql-12.x-scenario/pom.xml
@@ -19,25 +19,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>baidu-brpc-scenario</artifactId>
+ <groupId>org.apache.skywalking.apm.testcase</groupId>
+ <artifactId>graphql-12.x-scenario</artifactId>
+ <version>1.0.0</version>
<packaging>jar</packaging>
- <version>5.0.0</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>skywalking-graphql-12.x-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
-
- <test.framework.version>2.5.3</test.framework.version>
-
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
- <test.framework>baidu-brpc</test.framework>
+ <test.framework.version>9.0</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
+ <test.framework>graphql</test.framework>
</properties>
- <name>skywalking-baidu-brpc-scenario</name>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -52,9 +52,16 @@
<dependencies>
<dependency>
- <groupId>com.baidu</groupId>
- <artifactId>brpc-java</artifactId>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
<version>${test.framework.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -63,7 +70,7 @@
</dependencies>
<build>
- <finalName>baidu-brpc-scenario</finalName>
+ <finalName>graphql-12.x-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@@ -105,15 +112,4 @@
</plugin>
</plugins>
</build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <url>http://repo.spring.io/snapshot</url>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <url>http://repo.spring.io/milestone</url>
- </pluginRepository>
- </pluginRepositories>
-</project>
\ No newline at end of file
+</project>
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 0000000..2dde7cc
--- /dev/null
+++ b/test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/graphql-12.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
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 0000000..657ca45
--- /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 0000000..b9ebead
--- /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<User> 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 0000000..40f966a
--- /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 0000000..c23a2ba
--- /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 0000000..3d9f580
--- /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 0000000..12b708f
--- /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 0000000..3635484
--- /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 0000000..e8c461c
--- /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 0000000..9032d2a
--- /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/baidu-brpc-scenario/pom.xml b/test/plugin/scenarios/graphql-8.x-scenario/pom.xml
similarity index 82%
copy from test/plugin/scenarios/baidu-brpc-scenario/pom.xml
copy to test/plugin/scenarios/graphql-8.x-scenario/pom.xml
index 6063462..59412f0 100644
--- a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+++ b/test/plugin/scenarios/graphql-8.x-scenario/pom.xml
@@ -19,25 +19,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>baidu-brpc-scenario</artifactId>
+ <groupId>org.apache.skywalking.apm.testcase</groupId>
+ <artifactId>graphql-8.x-scenario</artifactId>
+ <version>1.0.0</version>
<packaging>jar</packaging>
- <version>5.0.0</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>skywalking-graphql-8.x-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
-
- <test.framework.version>2.5.3</test.framework.version>
-
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
- <test.framework>baidu-brpc</test.framework>
+ <test.framework.version>8.0</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
+ <test.framework>graphql</test.framework>
</properties>
- <name>skywalking-baidu-brpc-scenario</name>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -52,18 +52,24 @@
<dependencies>
<dependency>
- <groupId>com.baidu</groupId>
- <artifactId>brpc-java</artifactId>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
- <finalName>baidu-brpc-scenario</finalName>
+ <finalName>graphql-8.x-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@@ -105,15 +111,4 @@
</plugin>
</plugins>
</build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <url>http://repo.spring.io/snapshot</url>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <url>http://repo.spring.io/milestone</url>
- </pluginRepository>
- </pluginRepositories>
-</project>
\ No newline at end of file
+</project>
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 0000000..ead18b0
--- /dev/null
+++ b/test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/graphql-8.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
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 0000000..657ca45
--- /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 0000000..f960cd0
--- /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<User> 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 0000000..d77c76d
--- /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 0000000..40f966a
--- /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 0000000..3d9f580
--- /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 0000000..e5bbb29
--- /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 0000000..4f9535a
--- /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 0000000..1d679e4
--- /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 0000000..9032d2a
--- /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/baidu-brpc-scenario/pom.xml b/test/plugin/scenarios/graphql-9.x-scenario/pom.xml
similarity index 82%
copy from test/plugin/scenarios/baidu-brpc-scenario/pom.xml
copy to test/plugin/scenarios/graphql-9.x-scenario/pom.xml
index 6063462..4ce1b1e 100644
--- a/test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+++ b/test/plugin/scenarios/graphql-9.x-scenario/pom.xml
@@ -19,25 +19,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>baidu-brpc-scenario</artifactId>
+ <groupId>org.apache.skywalking.apm.testcase</groupId>
+ <artifactId>graphql-9.x-scenario</artifactId>
+ <version>1.0.0</version>
<packaging>jar</packaging>
- <version>5.0.0</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>skywalking-graphql-9.x-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
-
- <test.framework.version>2.5.3</test.framework.version>
-
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
- <test.framework>baidu-brpc</test.framework>
+ <test.framework.version>9.0</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
+ <test.framework>graphql</test.framework>
</properties>
- <name>skywalking-baidu-brpc-scenario</name>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -52,18 +52,24 @@
<dependencies>
<dependency>
- <groupId>com.baidu</groupId>
- <artifactId>brpc-java</artifactId>
+ <groupId>com.graphql-java</groupId>
+ <artifactId>graphql-java</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
- <finalName>baidu-brpc-scenario</finalName>
+ <finalName>graphql-9.x-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@@ -105,15 +111,4 @@
</plugin>
</plugins>
</build>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <url>http://repo.spring.io/snapshot</url>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <url>http://repo.spring.io/milestone</url>
- </pluginRepository>
- </pluginRepositories>
-</project>
\ No newline at end of file
+</project>
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 0000000..7a8dbc0
--- /dev/null
+++ b/test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/graphql-9.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
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 0000000..657ca45
--- /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 0000000..b9ebead
--- /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<User> 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 0000000..40f966a
--- /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 0000000..c23a2ba
--- /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 0000000..3d9f580
--- /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 0000000..77ff080
--- /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