You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2018/08/01 15:52:23 UTC

[incubator-skywalking] 01/02: Add server query module with sub module which implements graphql protocol.

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

hanahmily pushed a commit to branch 6.0
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 7551bc7d6c1344b2999202d04b86d3f88e8a6328
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Wed Aug 1 18:54:35 2018 +0800

    Add server query module with sub module which implements graphql protocol.
---
 oap-server/pom.xml                                 |  13 +++
 .../oap/server/core/query/QueryModule.java         |  39 +++++++
 ...ywalking.oap.server.library.module.ModuleDefine |   3 +-
 oap-server/server-query-plugin/pom.xml             |  36 +++++++
 .../query-graphql-plugin}/pom.xml                  |  39 +++----
 .../oap/query/graphql/GraphQLQueryConfig.java      |  35 ++++++
 .../oap/query/graphql/GraphQLQueryHandler.java     | 117 +++++++++++++++++++++
 .../oap/query/graphql/GraphQLQueryProvider.java    |  79 ++++++++++++++
 .../oap/query/graphql/resolver/Mutation.java       |  30 ++++++
 .../oap/query/graphql/resolver/Query.java          |  30 ++++++
 ...lking.oap.server.library.module.ModuleProvider} |   4 +-
 oap-server/server-starter/pom.xml                  |   8 ++
 .../src/main/resources/application.yml             |   3 +
 13 files changed, 407 insertions(+), 29 deletions(-)

diff --git a/oap-server/pom.xml b/oap-server/pom.xml
index 4c57bdc..21455a3 100644
--- a/oap-server/pom.xml
+++ b/oap-server/pom.xml
@@ -36,6 +36,7 @@
         <module>server-storage-plugin</module>
         <module>server-library</module>
         <module>server-starter</module>
+        <module>server-query-plugin</module>
     </modules>
 
     <properties>
@@ -56,6 +57,8 @@
         <elasticsearch.version>6.3.1</elasticsearch.version>
         <joda-time.version>2.9.9</joda-time.version>
         <kubernetes.version>2.0.0</kubernetes.version>
+        <graphql-java.version>8.0</graphql-java.version>
+        <graphql-java-tools.version>5.2.3</graphql-java-tools.version>
     </properties>
 
     <dependencies>
@@ -231,6 +234,16 @@
                 <artifactId>client-java</artifactId>
                 <version>${kubernetes.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.graphql-java</groupId>
+                <artifactId>graphql-java</artifactId>
+                <version>${graphql-java.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.graphql-java</groupId>
+                <artifactId>graphql-java-tools</artifactId>
+                <version>${graphql-java-tools.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 </project>
\ No newline at end of file
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/QueryModule.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/QueryModule.java
new file mode 100644
index 0000000..bbba731
--- /dev/null
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/QueryModule.java
@@ -0,0 +1,39 @@
+/*
+ * 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.oap.server.core.query;
+
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+
+/**
+ * The root module of Query plugin.
+ *
+ * @author gaohongtao
+ */
+public class QueryModule extends ModuleDefine {
+
+    private static final String NAME = "query";
+
+    @Override public String name() {
+        return NAME;
+    }
+
+    @Override public Class[] services() {
+        return new Class[] {};
+    }
+}
diff --git a/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine b/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
index d0a876f..af910c0 100644
--- a/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
+++ b/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
@@ -18,4 +18,5 @@
 
 org.apache.skywalking.oap.server.core.storage.StorageModule
 org.apache.skywalking.oap.server.core.cluster.ClusterModule
-org.apache.skywalking.oap.server.core.CoreModule
\ No newline at end of file
+org.apache.skywalking.oap.server.core.CoreModule
+org.apache.skywalking.oap.server.core.query.QueryModule
\ No newline at end of file
diff --git a/oap-server/server-query-plugin/pom.xml b/oap-server/server-query-plugin/pom.xml
new file mode 100644
index 0000000..2d388c4
--- /dev/null
+++ b/oap-server/server-query-plugin/pom.xml
@@ -0,0 +1,36 @@
+<?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>oap-server</artifactId>
+        <groupId>org.apache.skywalking</groupId>
+        <version>6.0.0-alpha-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>server-query-plugin</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>query-graphql-plugin</module>
+    </modules>
+
+</project>
\ No newline at end of file
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-query-plugin/query-graphql-plugin/pom.xml
similarity index 68%
copy from oap-server/server-starter/pom.xml
copy to oap-server/server-query-plugin/query-graphql-plugin/pom.xml
index 6f4335b..5bf921f 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-query-plugin/query-graphql-plugin/pom.xml
@@ -21,57 +21,46 @@
          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>oap-server</artifactId>
+        <artifactId>server-query-plugin</artifactId>
         <groupId>org.apache.skywalking</groupId>
         <version>6.0.0-alpha-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>server-starter</artifactId>
-    <packaging>jar</packaging>
+    <artifactId>query-graphql-plugin</artifactId>
 
     <dependencies>
         <dependency>
-            <groupId>org.yaml</groupId>
-            <artifactId>snakeyaml</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.skywalking</groupId>
-            <artifactId>server-core</artifactId>
+            <artifactId>library-module</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!-- cluster module -->
         <dependency>
             <groupId>org.apache.skywalking</groupId>
-            <artifactId>cluster-standalone-plugin</artifactId>
+            <artifactId>library-util</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.skywalking</groupId>
-            <artifactId>cluster-zookeeper-plugin</artifactId>
+            <artifactId>server-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!-- cluster module -->
-
-        <!-- receiver module -->
         <dependency>
             <groupId>org.apache.skywalking</groupId>
-            <artifactId>mesh-receiver-provider</artifactId>
+            <artifactId>apm-ui-protocol</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!-- receiver module -->
-
-        <!-- storage module -->
         <dependency>
-            <groupId>org.apache.skywalking</groupId>
-            <artifactId>storage-h2-plugin</artifactId>
-            <version>${project.version}</version>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.skywalking</groupId>
-            <artifactId>storage-elasticsearch-plugin</artifactId>
-            <version>${project.version}</version>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-tools</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
         </dependency>
-        <!-- storage module -->
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryConfig.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryConfig.java
new file mode 100644
index 0000000..328dd09
--- /dev/null
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryConfig.java
@@ -0,0 +1,35 @@
+/*
+ * 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.oap.query.graphql;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+
+/**
+ * The config of {@code query.graphql}.
+ *
+ * @author gaohongtao
+ */
+@Getter(AccessLevel.PACKAGE)
+@Setter(AccessLevel.PUBLIC)
+public class GraphQLQueryConfig extends ModuleConfig {
+    private String path;
+}
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryHandler.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryHandler.java
new file mode 100644
index 0000000..d98cd3b
--- /dev/null
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryHandler.java
@@ -0,0 +1,117 @@
+/*
+ * 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.oap.query.graphql;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
+import graphql.ExecutionInput;
+import graphql.ExecutionResult;
+import graphql.GraphQL;
+import graphql.GraphQLError;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import lombok.RequiredArgsConstructor;
+import org.apache.skywalking.oap.server.library.server.jetty.ArgumentsParseException;
+
+import org.apache.skywalking.oap.server.library.server.jetty.JettyJsonHandler;
+import org.apache.skywalking.oap.server.library.util.CollectionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RequiredArgsConstructor
+public class GraphQLQueryHandler extends JettyJsonHandler {
+
+    private static final Logger logger = LoggerFactory.getLogger(GraphQLQueryHandler.class);
+
+    private static final String QUERY = "query";
+    private static final String VARIABLES = "variables";
+    private static final String DATA = "data";
+    private static final String ERRORS = "errors";
+    private static final String MESSAGE = "message";
+
+    private final Gson gson = new Gson();
+
+    private final String path;
+
+    private final GraphQL graphQL;
+
+
+    @Override public String pathSpec() {
+        return path;
+    }
+
+    @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException {
+        throw new UnsupportedOperationException("GraphQL only supports POST method");
+    }
+
+    @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException, IOException {
+        BufferedReader reader = new BufferedReader(new InputStreamReader(req.getInputStream()));
+        String line;
+        StringBuilder request = new StringBuilder();
+        while ((line = reader.readLine()) != null) {
+            request.append(line);
+        }
+
+        JsonObject requestJson = gson.fromJson(request.toString(), JsonObject.class);
+
+        return execute(requestJson.get(QUERY).getAsString(), gson.fromJson(requestJson.get(VARIABLES), new TypeToken<Map<String, Object>>() {
+        }.getType()));
+    }
+
+    private JsonObject execute(String request, Map<String, Object> variables) {
+        try {
+            ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(request).variables(variables).build();
+            ExecutionResult executionResult = graphQL.execute(executionInput);
+            logger.debug("Execution result is {}", executionResult);
+            Object data = executionResult.getData();
+            List<GraphQLError> errors = executionResult.getErrors();
+            JsonObject jsonObject = new JsonObject();
+            if (data != null) {
+                jsonObject.add(DATA, gson.fromJson(gson.toJson(data), JsonObject.class));
+            }
+
+            if (CollectionUtils.isNotEmpty(errors)) {
+                JsonArray errorArray = new JsonArray();
+                errors.forEach(error -> {
+                    JsonObject errorJson = new JsonObject();
+                    errorJson.addProperty(MESSAGE, error.getMessage());
+                    errorArray.add(errorJson);
+                });
+                jsonObject.add(ERRORS, errorArray);
+            }
+            return jsonObject;
+        } catch (final Throwable e) {
+            logger.error(e.getMessage(), e);
+            JsonObject jsonObject = new JsonObject();
+            JsonArray errorArray = new JsonArray();
+            JsonObject errorJson = new JsonObject();
+            errorJson.addProperty(MESSAGE, e.getMessage());
+            errorArray.add(errorJson);
+            jsonObject.add(ERRORS, errorArray);
+            return jsonObject;
+        }
+    }
+}
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryProvider.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryProvider.java
new file mode 100644
index 0000000..5b26796
--- /dev/null
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/GraphQLQueryProvider.java
@@ -0,0 +1,79 @@
+/*
+ * 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.oap.query.graphql;
+
+import com.coxautodev.graphql.tools.SchemaParser;
+import graphql.GraphQL;
+import graphql.schema.GraphQLSchema;
+import org.apache.skywalking.oap.query.graphql.resolver.Mutation;
+import org.apache.skywalking.oap.query.graphql.resolver.Query;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.query.QueryModule;
+import org.apache.skywalking.oap.server.core.server.JettyHandlerRegister;
+import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+import org.apache.skywalking.oap.server.library.module.ModuleProvider;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
+
+/**
+ * GraphQL query provider.
+ *
+ * @author gaohongtao
+ */
+public class GraphQLQueryProvider extends ModuleProvider {
+
+    private final GraphQLQueryConfig config = new GraphQLQueryConfig();
+
+    private GraphQL graphQL;
+
+    @Override public String name() {
+        return "graphql";
+    }
+
+    @Override public Class<? extends ModuleDefine> module() {
+        return QueryModule.class;
+    }
+
+    @Override public ModuleConfig createConfigBeanIfAbsent() {
+        return config;
+    }
+
+    @Override public void prepare() throws ServiceNotProvidedException, ModuleStartException {
+        GraphQLSchema schema = SchemaParser.newParser()
+            .file("ui-graphql-v6/common.graphqls")
+            .resolvers(new Query(), new Mutation())
+            .build()
+            .makeExecutableSchema();
+        this.graphQL = GraphQL.newGraphQL(schema).build();
+    }
+
+    @Override public void start() throws ServiceNotProvidedException, ModuleStartException {
+        JettyHandlerRegister service = getManager().find(CoreModule.NAME).getService(JettyHandlerRegister.class);
+        service.addHandler(new GraphQLQueryHandler(config.getPath(), graphQL));
+    }
+
+    @Override public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException {
+
+    }
+
+    @Override public String[] requiredModules() {
+        return new String[0];
+    }
+}
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Mutation.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Mutation.java
new file mode 100644
index 0000000..769cec1
--- /dev/null
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Mutation.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.graphql.resolver;
+
+import com.coxautodev.graphql.tools.GraphQLMutationResolver;
+
+/**
+ * Root mutation resolver.
+ *
+ * @author gaohongtao
+ */
+public class Mutation implements GraphQLMutationResolver {
+    private String version;
+}
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Query.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Query.java
new file mode 100644
index 0000000..1735a86
--- /dev/null
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Query.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.graphql.resolver;
+
+import com.coxautodev.graphql.tools.GraphQLQueryResolver;
+
+/**
+ * Root Query Resolver.
+ *
+ * @author gaohongtao
+ */
+public class Query implements GraphQLQueryResolver {
+    private String version = "6.0";
+}
diff --git a/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
similarity index 82%
copy from oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
copy to oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
index d0a876f..edf950c 100644
--- a/oap-server/server-core/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
@@ -16,6 +16,4 @@
 #
 #
 
-org.apache.skywalking.oap.server.core.storage.StorageModule
-org.apache.skywalking.oap.server.core.cluster.ClusterModule
-org.apache.skywalking.oap.server.core.CoreModule
\ No newline at end of file
+org.apache.skywalking.oap.query.graphql.GraphQLQueryProvider
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-starter/pom.xml
index 6f4335b..5119310 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -73,5 +73,13 @@
             <version>${project.version}</version>
         </dependency>
         <!-- storage module -->
+
+        <!-- query module -->
+        <dependency>
+            <groupId>org.apache.skywalking</groupId>
+            <artifactId>query-graphql-plugin</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- query module -->
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml
index 2f27b61..cabf8a2 100644
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -37,3 +37,6 @@ storage:
   elasticsearch:
 service-mesh:
   default:
+query:
+  graphql:
+    path: /graphql