[GitHub] [skywalking] wu-sheng commented on a change in pull request #5030: support Graphql Logic endpoint

2020-07-07 Thread GitBox


wu-sheng commented on a change in pull request #5030:
URL: https://github.com/apache/skywalking/pull/5030#discussion_r451269460



##
File path: 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}'}

Review comment:
   Oh, I see, I didn't check that part. 





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [skywalking] wu-sheng commented on a change in pull request #5030: support Graphql Logic endpoint

2020-07-07 Thread GitBox


wu-sheng commented on a change in pull request #5030:
URL: https://github.com/apache/skywalking/pull/5030#discussion_r451259451



##
File path: 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}'}

Review comment:
   Why not? I added this new feature :) It is here
   
   
https://github.com/apache/skywalking/blob/310b8857b2266768ccd9e1338da13c86c313ed3f/docs/en/guides/Java-Plugin-Development-Guide.md#extension-logic-endpoint-tag-key-x-le





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [skywalking] wu-sheng commented on a change in pull request #5030: support Graphql Logic endpoint

2020-07-05 Thread GitBox


wu-sheng commented on a change in pull request #5030:
URL: https://github.com/apache/skywalking/pull/5030#discussion_r449874934



##
File path: test/plugin/scenarios/graphql-12.x-scenario/pom.xml
##
@@ -0,0 +1,126 @@
+
+
+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;>
+
+org.apache.skywalking.apm.testcase
+graphql-12.x-scenario
+1.0.0
+jar
+
+4.0.0
+
+skywalking-graphql-12.x-scenario
+
+
+UTF-8
+1.8
+2.1.6.RELEASE
+9.0
+1.18.10
+graphql
+
+
+
+
+
+org.springframework.boot
+spring-boot-dependencies
+${spring.boot.version}
+pom
+import
+
+
+
+
+
+
+com.graphql-java
+graphql-java
+${test.framework.version}
+provided
+
+
+org.projectlombok
+lombok
+${lombok.version}
+provided
+
+
+org.springframework.boot
+spring-boot-starter-web
+
+
+
+
+graphql-12.x-scenario
+
+
+org.springframework.boot
+spring-boot-maven-plugin
+
+
+
+repackage
+
+
+
+
+
+maven-compiler-plugin
+
+${compiler.version}
+${compiler.version}
+${project.build.sourceEncoding}
+
+
+
+org.apache.maven.plugins
+maven-assembly-plugin
+
+
+assemble
+package
+
+single
+
+
+
+
src/main/assembly/assembly.xml
+
+./target/
+
+
+
+
+
+
+
+
+
+spring-snapshots

Review comment:
   Why need this?

##
File path: test/plugin/scenarios/graphql-9.x-scenario/pom.xml
##
@@ -0,0 +1,125 @@
+
+
+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;>
+
+org.apache.skywalking.apm.testcase
+graphql-9.x-scenario
+1.0.0
+jar
+
+4.0.0
+
+skywalking-graphql-9.x-scenario
+
+
+UTF-8
+1.8
+2.1.6.RELEASE
+9.0
+1.18.10
+graphql
+
+
+
+
+
+org.springframework.boot
+spring-boot-dependencies
+${spring.boot.version}
+pom
+import
+
+
+
+
+
+
+com.graphql-java
+graphql-java
+${test.framework.version}
+
+
+org.projectlombok
+lombok
+${lombok.version}
+provided
+
+
+org.springframework.boot
+spring-boot-starter-web
+
+
+
+
+graphql-9.x-scenario
+
+
+org.springframework.boot
+spring-boot-maven-plugin
+
+
+
+repackage
+
+
+
+
+
+maven-compiler-plugin
+
+${compiler.version}
+${compiler.version}
+${project.build.sourceEncoding}
+
+
+
+org.apache.maven.plugins
+maven-assembly-plugin
+
+
+assemble
+package
+
+single
+
+
+
+
src/main/assembly/assembly.xml
+
+./target/
+
+
+
+
+
+
+
+
+
+spring-snapshots

Review comment:
   Same here.

##
File path: test/plugin/scenarios/graphql-8.x-scenario/pom.xml

[GitHub] [skywalking] wu-sheng commented on a change in pull request #5030: support Graphql Logic endpoint

2020-07-04 Thread GitBox


wu-sheng commented on a change in pull request #5030:
URL: https://github.com/apache/skywalking/pull/5030#discussion_r449766870



##
File path: 
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,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.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 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;
+}
+objInst.setSkyWalkingDynamicField(System.currentTimeMillis());
+}
+
+@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;
+}
+String name = parameters.getField().getSingleField().getName();
+long latency = System.currentTimeMillis() - (long) 
objInst.getSkyWalkingDynamicField();
+String info = buildLogicEndpointTagInfo(name, latency, null);
+AbstractSpan span = ContextManager.firstSpan();
+if (span == null || !span.isEntry()) {

Review comment:
   How a GraphQL span could not be the first span? Or not an entry span? A 
little confused.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org