GuiSong01 opened a new issue #6842:
URL: https://github.com/apache/skywalking/issues/6842


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [ ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   NettyRoutingFilterInterceptor  code in apm-spring-cloud-gateway-2.1.x-plugin.
   `
   public class NettyRoutingFilterInterceptor implements 
InstanceMethodsAroundInterceptor {
       @Override
       public void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes,
                                MethodInterceptResult result) throws Throwable {
           ServerWebExchange exchange = (ServerWebExchange) allArguments[0];
           EnhancedInstance enhancedInstance = getInstance(exchange);
   
           AbstractSpan span = 
ContextManager.createLocalSpan("SpringCloudGateway/RoutingFilter");
           if (enhancedInstance != null && 
enhancedInstance.getSkyWalkingDynamicField() != null) {
               ContextManager.continued((ContextSnapshot) 
enhancedInstance.getSkyWalkingDynamicField());
           }
           span.setComponent(SPRING_CLOUD_GATEWAY);
       }
   
       public static EnhancedInstance getInstance(Object o) {
           EnhancedInstance instance = null;
           if (o instanceof DefaultServerWebExchange) {
               instance = (EnhancedInstance) o;
           } else if (o instanceof ServerWebExchangeDecorator) {
               ServerWebExchange delegate = ((ServerWebExchangeDecorator) 
o).getDelegate();
               return getInstance(delegate);
           }
           return instance;
       }
   
       @Override
       public Object afterMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes,
                                 Object ret) throws Throwable {
           return ret;
       }
   
       @Override
       public void handleMethodException(EnhancedInstance objInst, Method 
method, Object[] allArguments,
                                         Class<?>[] argumentsTypes, Throwable 
t) {
           ContextManager.activeSpan().log(t);
       }
   }
   `
   afterMethod function do nothing, how to clear trace context in CONTEXT 
ThreadLocal.


-- 
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]


Reply via email to