[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-21 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r337195869
 
 

 ##
 File path: Jenkinsfile-Agent-Test
 ##
 @@ -88,6 +88,12 @@ pipeline {
 sh 'bash test/plugin/run.sh 
--build_id=wl1_${BUILD_ID} spring-async-scenario'
 }
 }
+
+stage('netty-socketio 1.x (4)') {
+steps {
+sh 'bash test/plugin/run.sh 
--build_id=${BUILD_ID} netty-socketio-scenario'
 
 Review comment:
   `--build_id=wl1_${BUILD_ID}` should replace --build_id=${BUILD_ID}


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-20 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336827500
 
 

 ##
 File path: Jenkinsfile-Agent-Test
 ##
 @@ -81,11 +81,17 @@ pipeline {
 }
 }
 
-stage('spring async 4.3.x-5.1.x (35)') {
-steps {
 
 Review comment:
   You should keep it unchanged. Whitespace mostly


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-20 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336788639
 
 

 ##
 File path: 
apm-sniffer/apm-sdk-plugin/netty-socketio-plugin/src/test/java/org/apache/skywalking/apm/plugin/netty/socketio/NettySocketIOTest.java
 ##
 @@ -0,0 +1,154 @@
+/*
+ * 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.netty.socketio;
+
+import com.corundumstudio.socketio.SocketIOClient;
+import com.corundumstudio.socketio.handler.ClientHead;
+import com.corundumstudio.socketio.namespace.Namespace;
+import com.corundumstudio.socketio.protocol.Packet;
+import com.corundumstudio.socketio.transport.NamespaceClient;
+import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
+import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
+import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
+import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import org.powermock.reflect.Whitebox;
+
+import java.lang.reflect.Method;
+import java.net.InetSocketAddress;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.powermock.api.mockito.PowerMockito.when;
+
+/**
+ * @author MrPro
+ */
+@RunWith(PowerMockRunner.class)
+@PowerMockRunnerDelegate(TracingSegmentRunner.class)
+public class NettySocketIOTest {
+
+@SegmentStoragePoint
+private SegmentStorage segmentStorage;
+
+@Rule
+public AgentServiceRule serviceRule = new AgentServiceRule();
+
+private NettySocketIOConnectionInterceptor connectionInterceptor;
+private NettySocketIOOnEventInterceptor onEventInterceptor;
+private NettySocketIORoomInterceptor roomInterceptor;
+private NettySocketIOConstructorInterceptor constructorInterceptor;
+
+@Mock
+private SocketIOClient socketIOClient;
+@Mock
+private Packet sendPacket;
+@Mock
+private ClientHead clientHead;
+@Mock
+private Namespace namespace;
+
+private Method connectOnConnectMethod;
+private Method connectOnDisConnectMethod;
+private Method roomLeaveMethod;
+private Method roomJoinMethod;
+
+private NettySocketIOClientInfo socketIOClientInfo = new 
NettySocketIOClientInfo(null, null, "127.0.0.1:9092");
+
+private EnhancedInstance enhancedInstance = new EnhancedInstance() {
+@Override
+public Object getSkyWalkingDynamicField() {
+return socketIOClientInfo;
+}
+
+@Override
+public void setSkyWalkingDynamicField(Object value) {
+
+}
+};
+
+@Before
+public void setUp() {
+InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 9092);
 
 Review comment:
   Binding to a static port in the test is dangerous, right? 
   We should bind for `0` to represent a random port, am I right?
   @kezhenxu94 


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-18 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336423773
 
 

 ##
 File path: 
apm-sniffer/apm-sdk-plugin/netty-socketio-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/socketio/NettySocketIOSendInterceptor.java
 ##
 @@ -0,0 +1,58 @@
+/*
+ * 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.netty.socketio;
+
+import com.corundumstudio.socketio.protocol.Packet;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author MrPro
+ */
+public class NettySocketIOSendInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+@Override
+public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+
+NettySocketIOClientInfo clientInfo = (NettySocketIOClientInfo) 
objInst.getSkyWalkingDynamicField();
+Packet packet = (Packet) allArguments[0];
+
+AbstractSpan span = ContextManager.createExitSpan("SocketIO/" + 
packet.getName() + "/send", clientInfo.getClientAddress());
 
 Review comment:
   Agree. at least from the span you created, nothing special.


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-17 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336317686
 
 

 ##
 File path: 
apm-sniffer/apm-sdk-plugin/netty-socketio-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/socketio/NettySocketIOOnEventInterceptor.java
 ##
 @@ -0,0 +1,61 @@
+/*
+ * 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.netty.socketio;
+
+import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author MrPro
+ */
+public class NettySocketIOOnEventInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+@Override
+public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+String eventName = (String) allArguments[1];
+
+// no place to get context carrier
+ContextCarrier contextCarrier = new ContextCarrier();
 
 Review comment:
   Need or not, I am not sure. I am trying tl understand your scenarios. I have 
concerns of your topo, likr I said when you creating exit span.


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-17 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336317474
 
 

 ##
 File path: 
apm-sniffer/apm-sdk-plugin/netty-socketio-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/socketio/NettySocketIOSendInterceptor.java
 ##
 @@ -0,0 +1,58 @@
+/*
+ * 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.netty.socketio;
+
+import com.corundumstudio.socketio.protocol.Packet;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author MrPro
+ */
+public class NettySocketIOSendInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+@Override
+public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+
+NettySocketIOClientInfo clientInfo = (NettySocketIOClientInfo) 
objInst.getSkyWalkingDynamicField();
+Packet packet = (Packet) allArguments[0];
+
+AbstractSpan span = ContextManager.createExitSpan("SocketIO/" + 
packet.getName() + "/send", clientInfo.getClientAddress());
 
 Review comment:
   My point is, if it don't propagate context, then, it is limited feature. 
Especially, you are creating exit span based on client IPs, then do you try 
what happens, id these IP are from Internet? thousands of nodes are created in 
the topology map. Is that what you need?


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


With regards,
Apache Git Services


[GitHub] [skywalking] wu-sheng commented on a change in pull request #3640: Provide agent plugin netty-socketio

2019-10-17 Thread GitBox
wu-sheng commented on a change in pull request #3640: Provide agent plugin 
netty-socketio
URL: https://github.com/apache/skywalking/pull/3640#discussion_r336174353
 
 

 ##
 File path: 
apm-sniffer/apm-sdk-plugin/netty-socketio-plugin/src/main/java/org/apache/skywalking/apm/plugin/netty/socketio/NettySocketIOOnEventInterceptor.java
 ##
 @@ -0,0 +1,61 @@
+/*
+ * 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.netty.socketio;
+
+import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author MrPro
+ */
+public class NettySocketIOOnEventInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+@Override
+public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+String eventName = (String) allArguments[1];
+
+// no place to get context carrier
+ContextCarrier contextCarrier = new ContextCarrier();
 
 Review comment:
   Could we discuss why there is no place to get context? If no, then trace 
always breaks here. 
   I saw you have entry and exit spans both. So, these two should match. 
Otherwise, there is no distributed tracing here, what is point of providing 
this plugin?


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


With regards,
Apache Git Services