yqw570994511 commented on PR #736:
URL: https://github.com/apache/skywalking-java/pull/736#issuecomment-2543912442

   > It is good to see tests are passed. Thanks.
   > 
   > One question about this 
[doc](https://skywalking.apache.org/docs/skywalking-java/next/en/setup/service-agent/java-agent/application-toolkit-webflux/#fetch-trace-context-relative-ids),
 with your new plugin gets merged, does user still need to add manual codes? 
Which scenarios are automatically working, which are still not?
   
   Writing code similar to this is enough:
   ```
   @Component
   public class Filter1 implements GlobalFilter, Ordered {
   
       private static final Logger log = LoggerFactory.getLogger(Filter1.class);
       @Override
       public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain 
chain) {
           log.info("filter1 running");
   
           // fetch trace ID
           String traceId = TraceContext.traceId();
           log.info("filter1 traceId: {}", traceId);
   
           // fetch segment ID
           String segmentId = TraceContext.segmentId();
           log.info("filter1 segmentId: {}", segmentId);
   
           // fetch span ID
           int spanId = TraceContext.spanId();
           log.info("filter1 spanId: {}", spanId);
   
           return chain.filter(exchange);
       }
       @Override
       public int getOrder() {
           return -100;
       }
   }
   ```
   ```
   @Component
   public class GatewayFilter1 implements GatewayFilter {
   
       private static final Logger log = 
LoggerFactory.getLogger(GatewayFilter1.class);
       @Override
       public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain 
chain) {
           log.info("gatewayFilter1 running");
           return chain.filter(exchange);
       }
   }
   ```
   
   The results obtained are as follows:
   
![image](https://github.com/user-attachments/assets/c61622c4-2329-42fe-815d-dbb64790c820)
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to