wu-sheng commented on a change in pull request #3323: Add Light4j plugin
URL: https://github.com/apache/skywalking/pull/3323#discussion_r318429509
 
 

 ##########
 File path: 
apm-sniffer/apm-sdk-plugin/light4j-plugins/light4j-1.6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/light4j/HandleRequestInterceptor.java
 ##########
 @@ -0,0 +1,62 @@
+/*
+ * 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.light4j;
+
+import io.undertow.server.HttpServerExchange;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+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;
+
+/**
+ * {@link HandleRequestInterceptor} creates a local span when the {@link 
com.networknt.handler.LightHttpHandler#handleRequest(HttpServerExchange)}
+ * method executes. {@link com.networknt.handler.LightHttpHandler} is 
implemented by various middleware and business handlers and
+ * the Light4J framework runs these in succession. Thus when a request is 
sent, a chain of
+ * {@link org.apache.skywalking.apm.agent.core.context.trace.LocalSpan}s is 
expected to be produced.
+ *
+ * @author tsuilouis
+ */
+public class HandleRequestInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+    @Override
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class<?>[] argumentsTypes,
+                             MethodInterceptResult result) {
+        String operationName = objInst.getClass().getName() + "." + 
method.getName();
+        ContextManager.createLocalSpan(operationName)
 
 Review comment:
   I think Light4j should exist in `supported-list`. If the undertow plugin 
will create the entry span, then it makes sense to me.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to