You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/03/10 23:45:03 UTC

[GitHub] [incubator-skywalking] wu-sheng commented on issue #2341: Support plugin for Vert.x

wu-sheng commented on issue #2341: Support plugin for Vert.x
URL: https://github.com/apache/incubator-skywalking/issues/2341#issuecomment-471366370
 
 
   > If my understanding is correct what would you guys recommend to tackle this issue?
   
   I think most of your understanding is correct, the thread model of vert.x is a typical model in RPC framework. Also, SkyWalking did request the TracingContext working in that way, most of tracing system asked for this too.
   
   The key is, you created the span in a shared thread(that single thread, I am guessing this is nio/vertx event loop thread).  SkyWalking is focusing on business logic, the span could be created at the entrance of business codes, such as we did for SpringMVC. We create span at Controller edge, then, no matter which web container is used inside, the span will work as expected.  
   
   Like in the codes
   ```
   public class MyServer extends AbstractVerticle {
    
       @Override
       public void start() {
    
           Router router = Router.router(vertx);
    
           router.route().handler(this::queryHandler);
           vertx.createHttpServer().requestHandler(router::accept)
                   .listen(8080);
           System.out.println("MyServer startup");
       }
    
       private void queryHandler(RoutingContext routingContext) {
           routingContext.response()
                   .putHeader("content_type", "application/json")
                   .end("hello world");
       }
   ```
   
   Span should be created when `#requestHandler` called, there should not be a shared thread at this point, because it can't in Java thread model, the `requestHandler` will hold the thread until it is done or start a child thread(that is context capture/continue designed for)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services